Browse Source

Copilot support

main
Yigit Colakoglu 1 year ago
parent
commit
6f8ae21825
6 changed files with 28 additions and 28 deletions
  1. +1
    -0
      .config/nvim/lazy-lock.json
  2. +0
    -1
      .config/nvim/lua/config/lsp/init.lua
  3. +11
    -23
      .config/nvim/lua/config/plugin/copilot.lua
  4. +7
    -0
      .config/nvim/lua/config/plugin/lualine.lua
  5. +5
    -3
      .config/nvim/lua/config/plugin/nvim-cmp.lua
  6. +4
    -1
      .config/nvim/lua/plugins.lua

+ 1
- 0
.config/nvim/lazy-lock.json View File

@ -15,6 +15,7 @@
"cmp-snippy": { "branch": "master", "commit": "6e39210aa3a74e2bf6462f492eaf0d436cd2b7d3" },
"cmp-vimtex": { "branch": "master", "commit": "e0c24bb0da89a71fab02c2a4670a25670714ba36" },
"copilot-cmp": { "branch": "master", "commit": "72fbaa03695779f8349be3ac54fa8bd77eed3ee3" },
"copilot-lualine": { "branch": "main", "commit": "4dd368bed56c424b4a6822ad007b7540d472ae6d" },
"copilot.lua": { "branch": "master", "commit": "858bbfa6fa81c88fb1f64107d7981f1658619e0a" },
"dap-buddy.nvim": { "branch": "main", "commit": "bbda2b062e5519cde4e10b6e4240d3dd1f867b20" },
"diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" },


+ 0
- 1
.config/nvim/lua/config/lsp/init.lua View File

@ -99,7 +99,6 @@ local lspconfigs = {
}
local mason_extras = {
"bash-debug-adapter"
}
return {


+ 11
- 23
.config/nvim/lua/config/plugin/copilot.lua View File

@ -1,24 +1,12 @@
-- Set copilot_no_tab_map to true
vim.g.copilot_no_tab_map = true
-- Map <C-J> in insert mode to copilot#Accept("<CR>")
vim.api.nvim_set_keymap('i', '<C-J>', 'v:lua.copilot_accept()', { silent = true, expr = true })
-- Function to handle copilot#Accept("<CR>")
function copilot_accept()
return vim.fn["copilot#Accept"]("<CR>")
return function ()
require("copilot").setup({
auto_refresh = false,
suggestion = {
enabled = false,
auto_trigger = false,
},
panel = {
enabled = false
},
})
end
-- Disable copilot for certain filetypes
vim.g.copilot_filetypes = {
["*"] = false,
["javascript"] = true,
["typescript"] = true,
["lua"] = false,
["rust"] = true,
["c"] = true,
["c#"] = true,
["c++"] = true,
["go"] = true,
["python"] = true,
}

+ 7
- 0
.config/nvim/lua/config/plugin/lualine.lua View File

@ -193,6 +193,13 @@ local config = function()
color = { fg = '#ffffff', gui = 'bold' },
}
ins_right {
'copilot',
show_colors = true,
show_loading = true
}
-- Add components to right sections
ins_right {
'o:encoding', -- option component same as &encoding in viml


+ 5
- 3
.config/nvim/lua/config/plugin/nvim-cmp.lua View File

@ -31,12 +31,13 @@ return function()
end, {"i","s","c",}),
}),
sources = cmp.config.sources({
{ name = "copilot" },
{ name = 'nvim_lsp' },
{ name = 'snippy' },
{ name = 'vimtex', }
{ name = 'vimtex', },
{ name = 'path' },
}, {
{ name = 'buffer' },
{ name = 'path' },
}),
formatting = {
format = lspkind.cmp_format({
@ -46,7 +47,8 @@ return function()
ellipsis_char = '...',
before = function (entry, vim_item)
return vim_item
end
end,
symbol_map = { Copilot = "" },
})
}
})


+ 4
- 1
.config/nvim/lua/plugins.lua View File

@ -34,6 +34,9 @@ return {
"catppuccin/nvim",
"nvim-tree/nvim-web-devicons",
'rmagatti/auto-session',
'AndreM222/copilot-lualine',
"zbirenbaum/copilot.lua",
},
config = require("config.plugin.lualine"),
},
@ -219,7 +222,7 @@ return {
"zbirenbaum/copilot.lua",
cmd = "Copilot",
event = "InsertEnter",
opts = {},
config = require("config.plugin.copilot")
},
{
"zbirenbaum/copilot-cmp",


Loading…
Cancel
Save