I tried many things, even tried to work with chatgpt throught that, but i cant at all completely forbid TAB accepting copilot suggestions.
- I use blink.cmp and i have it select and accept suggestion from menu using TAB
- I want for copilot to only and only use C-i to accept its ghost suggestion
I cant make 2. work as expected, i did bind C-i to accept copilot, but i cant at all remove copilot from changing my TAB behaviour.
Right now if there is completion menu from blink.cmp and ghost suggestion from copilot TAB will accept copilot. Here is my copilot.lua and blink.cmp configs
{
"zbirenbaum/copilot.lua",
cmd = "Copilot",
event = "InsertEnter",
config = function()
require("copilot").setup({
suggestion = {
enabled = true,
auto_trigger = true,
hide_during_completion = true,
keymap = {
accept = "<C-i>",
},
},
})
vim.keymap.set('i', '<C-i>', function()
if require("copilot.suggestion").is_visible() then
require("copilot.suggestion").accept()
end
end)
vim.api.nvim_set_hl(0, "CopilotSuggestion", { fg = "#404040" })
end,
}
{
"saghen/blink.cmp",
dependencies = {
'rafamadriz/friendly-snippets',
},
lazy = false,
build = 'cargo +nightly build --release',
opts = {
keymap = {
['<C-i>'] = {},
['<C-j>'] = { 'select_next', 'fallback' },
['<C-k>'] = { 'select_prev', 'fallback' },
['<Tab>'] = { 'select_and_accept', 'fallback' },
['<CR>'] = { 'select_and_accept', 'fallback' },
['<C-space>'] = { 'show', 'show_documentation', 'hide_documentation', "fallback" },
['<C-y>'] = { 'scroll_documentation_up', 'fallback' },
['<C-e>'] = { 'scroll_documentation_down', 'fallback' },
['<C-s>'] = { 'show_signature', 'fallback', 'hide_signature' },
['<C-n>'] = { 'snippet_forward', 'fallback' },
['<C-s-n>'] = { 'snippet_backward', 'fallback' }
},
fuzzy = {
implementation = "prefer_rust_with_warning",
use_proximity = true,
prebuilt_binaries = {
download = true,
}
},
sources = {
default = { "lazydev", "lsp", "path", "snippets", "buffer" },
providers = {
lazydev = {
name = "LazyDev",
module = "lazydev.integrations.blink",
score_offset = 100,
},
},
},
signature = {
enabled = true,
trigger = {
enabled = true,
}
},
completion = {
ghost_text = { enabled = false, show_with_menu = false },
keyword = {
range = 'prefix',
},
accept = { auto_brackets = { enabled = false } },
menu = {
draw = {
columns = { { "kind_icon" }, { "label", gap = 1 } },
components = {
label = {
text = function(ctx)
return require("colorful-menu").blink_components_text(ctx)
end,
highlight = function(ctx)
return require("colorful-menu").blink_components_highlight(ctx)
end,
},
},
},
auto_show = true,
auto_show_delay_ms = 0,
},
list = {
selection = {
preselect = true,
auto_insert = false
}
},
}
},
},
I tried many things, even tried to work with chatgpt throught that, but i cant at all completely forbid TAB accepting copilot suggestions.
I cant make 2. work as expected, i did bind C-i to accept copilot, but i cant at all remove copilot from changing my TAB behaviour.
Right now if there is completion menu from blink.cmp and ghost suggestion from copilot TAB will accept copilot. Here is my copilot.lua and blink.cmp configs
{ "zbirenbaum/copilot.lua", cmd = "Copilot", event = "InsertEnter", config = function() require("copilot").setup({ suggestion = { enabled = true, auto_trigger = true, hide_during_completion = true, keymap = { accept = "<C-i>", }, }, }) vim.keymap.set('i', '<C-i>', function() if require("copilot.suggestion").is_visible() then require("copilot.suggestion").accept() end end) vim.api.nvim_set_hl(0, "CopilotSuggestion", { fg = "#404040" }) end, }{ "saghen/blink.cmp", dependencies = { 'rafamadriz/friendly-snippets', }, lazy = false, build = 'cargo +nightly build --release', opts = { keymap = { ['<C-i>'] = {}, ['<C-j>'] = { 'select_next', 'fallback' }, ['<C-k>'] = { 'select_prev', 'fallback' }, ['<Tab>'] = { 'select_and_accept', 'fallback' }, ['<CR>'] = { 'select_and_accept', 'fallback' }, ['<C-space>'] = { 'show', 'show_documentation', 'hide_documentation', "fallback" }, ['<C-y>'] = { 'scroll_documentation_up', 'fallback' }, ['<C-e>'] = { 'scroll_documentation_down', 'fallback' }, ['<C-s>'] = { 'show_signature', 'fallback', 'hide_signature' }, ['<C-n>'] = { 'snippet_forward', 'fallback' }, ['<C-s-n>'] = { 'snippet_backward', 'fallback' } }, fuzzy = { implementation = "prefer_rust_with_warning", use_proximity = true, prebuilt_binaries = { download = true, } }, sources = { default = { "lazydev", "lsp", "path", "snippets", "buffer" }, providers = { lazydev = { name = "LazyDev", module = "lazydev.integrations.blink", score_offset = 100, }, }, }, signature = { enabled = true, trigger = { enabled = true, } }, completion = { ghost_text = { enabled = false, show_with_menu = false }, keyword = { range = 'prefix', }, accept = { auto_brackets = { enabled = false } }, menu = { draw = { columns = { { "kind_icon" }, { "label", gap = 1 } }, components = { label = { text = function(ctx) return require("colorful-menu").blink_components_text(ctx) end, highlight = function(ctx) return require("colorful-menu").blink_components_highlight(ctx) end, }, }, }, auto_show = true, auto_show_delay_ms = 0, }, list = { selection = { preselect = true, auto_insert = false } }, } }, },