-
I'm now currently using Copilot.vim 1.4.3, and I've tried 1.5.0, 1.5.1 as well. I haven't tried other versions but all of them had the problem where sometimes when I confirm the strings, After some Googling I found that it's probably a backspace character, but my keybinding doesn't contains a backspace, (it's alt+N, or Meta-N. I've also tried so it shouldn't be a problem). Do anyone has any idea on how to fix this? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 13 replies
-
I have the same issue, sometimes copilot add '<80>kl<80>kD<80>kl<80' before result. |
Beta Was this translation helpful? Give feedback.
-
I had the same issue when using copilot alongside nvim-cmp. Setting the Here is the relevant portion of my configuration: vim.g.copilot_no_tab_map = true
vim.keymap.set(
"i",
"<Plug>(vimrc:copilot-dummy-map)",
'copilot#Accept("")',
{ silent = true, expr = true, desc = "Copilot dummy accept" }
)
local cmp = require("cmp")
cmp.setup {
mapping = {
['<M-;>'] = cmp.mapping(function(fallback)
vim.api.nvim_feedkeys(vim.fn['copilot#Accept'](vim.api.nvim_replace_termcodes('<Tab>', true, true, true)), 'n', true)
end)
},
}
|
Beta Was this translation helpful? Give feedback.
-
@Leixb Don't you need to add copilot as a nvim-cmp source? This doesn't seem to work for me :/ |
Beta Was this translation helpful? Give feedback.
-
If anyone else is stumbling on this issue then this is how I solved it:
local map = vim.keymap.set
map("i", "<C-j>", "copilot#Accept('<CR>')", {noremap = true, silent = true, expr=true })
local map = function (type, key, value, opts)
local options = { noremap = true }
if opts then options = vim.tbl_extend('force', options, opts) end
vim.api.nvim_set_keymap(type, key, value, options)
end Seems to have fixed the issue :) |
Beta Was this translation helpful? Give feedback.
-
I tried understanding why @ArtursTimofejevs's suggestion worked, and I think I might have found something in the help for
So I was able to fix it by keeping the use of local map = vim.keymap.set
map("i", "<C-j>", "copilot#Accept('<CR>')", {noremap = true, silent = true, expr=true, replace_keycodes = false }) I believe this fixed the issue for me. |
Beta Was this translation helpful? Give feedback.
I tried understanding why @ArtursTimofejevs's suggestion worked, and I think I might have found something in the help for
vim.keymap.set
when looking at the{opts}
(the{noremap = true, silent = true, expr=true }
in the example)So I was able to fix it by keeping the use of
vim.keymap.set
but just adding, replace_keycodes = false
:I believe this fixed the issue for me.