diff --git a/init.lua b/init.lua index 8161365b..b637b540 100644 --- a/init.lua +++ b/init.lua @@ -293,6 +293,9 @@ require('lazy').setup({ }, }, }, + { + 'giuxtaposition/blink-cmp-copilot', + }, -- NOTE: Plugins can also be configured to run Lua code when they are loaded. -- @@ -771,6 +774,9 @@ require('lazy').setup({ return 'make install_jsregexp' end)(), dependencies = { + -- Add the copilot source for blink here as well to ensure it loads + 'giuxtaposition/blink-cmp-copilot', + 'zbirenbaum/copilot.lua', -- Ensure the base copilot plugin is also present -- `friendly-snippets` contains a variety of premade snippets. -- See the README about individual language/framework/plugin snippets: -- https://github.com/rafamadriz/friendly-snippets @@ -829,8 +835,14 @@ require('lazy').setup({ }, sources = { - default = { 'lsp', 'path', 'snippets', 'lazydev' }, + default = { 'copilot', 'lsp', 'path', 'snippets', 'lazydev' }, providers = { + copilot = { + name = 'copilot', + module = 'blink-cmp-copilot', + score_offset = 100, + async = true, + }, lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 }, }, }, diff --git a/lua/custom/plugins/copilot.lua b/lua/custom/plugins/copilot.lua index 8a70374d..a67d4fc6 100644 --- a/lua/custom/plugins/copilot.lua +++ b/lua/custom/plugins/copilot.lua @@ -2,24 +2,19 @@ return { 'zbirenbaum/copilot.lua', cmd = 'Copilot', event = 'InsertEnter', - -- Load before nvim-cmp to ensure copilot is ready - priority = 100, - config = function() - require('copilot').setup { - suggestion = { - enabled = true, - auto_trigger = true, -- Need to trigger to get suggestions for copilot-cmp - debounce = 75, - keymap = { - accept = false, -- Disable accept keymap, use copilot-cmp instead - accept_word = false, - accept_line = false, - next = '', - prev = '', - dismiss = '', - }, + dependencies = { + 'copilotlsp-nvim/copilot-lsp', + }, + opts = { + nes = { + enabled = true, + keymap = { + accept_and_goto = 'p', + accept = false, + dismiss = '', }, - panel = { enabled = true }, - } - end, + }, + suggestion = { enabled = false }, + panel = { enabled = false }, + }, }