Exafunction / codeium.vim

Free, ultrafast Copilot alternative for Vim and Neovim
https://codeium.com
MIT License
4.3k stars 157 forks source link

Accept corrupts special registers #109

Open ragu-manjegowda opened 1 year ago

ragu-manjegowda commented 1 year ago

I have the following to accept suggestion,

vim.keymap.set('i', '<C-e>', function()
    return vim.fn['codeium#Accept']()
end, { expr = true, silent = true, desc = 'Codeium accept suggestion' })

and the following to manage clipboard,

if vim.fn.has('clipboard') == 1 then
  if vim.fn.has('unnamedplus') == 1 then
    vim.o.clipboard = 'unnamedplus'
  else
    vim.o.clipboard = 'unnamed'
  end

Whenever I accept codeium suggestion, contents of following special registers gets erased/corrupted.

on MacOS -> `", *, +, -`
on Linux ->  `", +, -`

I am using xclip on Linux (Arch, Ubuntu 20.04), and pbcopy on MacOS.

Let me know if you need any other information.

AlansCodeLog commented 1 year ago

I was scratching my head about this issue. My clipboard would randomly change or be blank or only have parts of what I'd copy. I thought it was something else about my setup, but it's definitely the accepting of a suggestion that causes it, which is why it seemed so random.