Exafunction / codeium.vim

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

Custom Keybindings/Completions #10

Closed David-Kunz closed 1 year ago

David-Kunz commented 1 year ago

Hi 👋 ,

Thanks for this great plugin, it's important to have a free CoPilot alternative!

Would it be possible to

Thanks again and best regards, David

AnthonyUtt commented 1 year ago

I don't have a solution for your second or third points, but you can add more bindings for codeium-* using the following snippet:

imap <C-d> <Plug>(codeium-dismiss)
imap <M-<> <Plug>(codeium-previous)
imap <M->> <Plug>(codeium-next)

Just replace the <C-d>|<M-<>|<M->> with whatever you want that binding to be. (Note: I am using vim-plug, this may differ for other plugin managers.)

ragu-manjegowda commented 1 year ago

provide the respective commands for codeium-dismiss, codeium-next and codeium-previous?

Looks like it's already there, just that README needs update,

codeium#Clear
codeium#CycleCompletions(1)
codeium#CycleCompletions(-1)
    vim.keymap.set('i', '<C-l>', function()
        return vim.fn['codeium#Accept']()
    end, { expr = true })

disable auto completion (per configuration), i.e. only show suggestions when a user triggers codeium-next/codeium-previous? disable the default keymaps (per configuration)?

In addition to this, I would like to have ability to accept suggestions incrementally. May be something like we have in terminal, one "^[F" forward-word at a time.

Edit:

In addition to this, I would like to have ability to accept suggestions incrementally. May be something like we have in terminal, one "^[F" forward-word at a time.

There is already an open issue for this.

David-Kunz commented 1 year ago

Thank you @AnthonyUtt and @ragu-manjegowda , I can confirm

vim.keymap.set('i', '<c-;>', function() return vim.fn['codeium#CycleCompletions'](1) end, { expr = true })
vim.keymap.set('i', '<c-,>', function() return vim.fn['codeium#CycleCompletions'](-1) end, { expr = true })
vim.keymap.set('i', '<c-x>', function() return vim.fn['codeium#Clear']() end, { expr = true })
vim.keymap.set('i', '<c-cr>', function() return vim.fn['codeium#Accept']() end, { expr = true })

works! (Even though cycling often gives the same result, making it effectively a no-op.)

Minion3665 commented 1 year ago

disable the default keymaps (per configuration)?

This is very important to me; I have a heavily overloaded tab key and having codeium clobber it is a dealbreaker- I'm working on updating my configuration so codeium plays a little nicer with everything else but until then I'll have to keep it disabled (#13 would also solve this)