diff --git a/lua/custom/plugins/blink.lua b/lua/custom/plugins/blink.lua index 1baf69e0..3f70437d 100644 --- a/lua/custom/plugins/blink.lua +++ b/lua/custom/plugins/blink.lua @@ -1,6 +1,29 @@ return { 'saghen/blink.cmp', + dependencies = { + "giuxtaposition/blink-cmp-copilot", + }, opts = { + sources = { + default = { "lsp", "path", "copilot", "buffer" }, + providers = { + copilot = { + name = "copilot", + module = "blink-cmp-copilot", + score_offset = 100, -- High priority to show Copilot near the top + async = true, + }, + }, + }, + keymap = { + preset = 'default', + accept = '', -- Your preferred accept key + }, + appearance = { + -- Show source of completion (LSP/Copilot/Buffer) + use_nvim_cmp_as_default = false, + nerd_font_variant = 'mono', + }, fuzzy = {}, }, } diff --git a/lua/custom/plugins/copilot.lua b/lua/custom/plugins/copilot.lua index 18744d84..f46c2590 100644 --- a/lua/custom/plugins/copilot.lua +++ b/lua/custom/plugins/copilot.lua @@ -1,14 +1,35 @@ return { + -- Use copilot.lua for API access (no UI) { - 'github/copilot.vim', - event = 'VimEnter', + "zbirenbaum/copilot.lua", + cmd = "Copilot", + event = "InsertEnter", config = function() - -- Accept suggestion with Ctrl-y - vim.keymap.set('i', '', 'copilot#Accept("\\")', { - expr = true, - replace_keycodes = false + require("copilot").setup({ + suggestion = { enabled = false }, -- Disable inline ghost text + panel = { enabled = false }, -- Disable suggestion panel + filetypes = { + yaml = false, + markdown = false, + help = false, + gitcommit = false, + gitrebase = false, + hgcommit = false, + svn = false, + cvs = false, + ["."] = false, + }, + copilot_node_command = 'node', -- Node.js version must be > 18.x + server_opts_overrides = {}, }) - vim.g.copilot_no_tab_map = true end, }, + + -- Bridge between copilot.lua and blink.cmp + { + "giuxtaposition/blink-cmp-copilot", + dependencies = { + "zbirenbaum/copilot.lua", + }, + }, }