Closed vinoff closed 1 year ago
Maybe you just need to remove the argument "<Right>"
from the call, as per README.
Doing:
imap <silent><script><expr> <Right> codeium#Accept()
sorta works, but now the right arrow doesn't behave as expected when there is no codeium suggestions...
I'm not familiar with Vim Script, so I cannot help you further If you want to have a multiplex <Right>
. If Codeium.vim might provide an api to let you know if any suggestion is visible, then I believe what you're saying can be easily achieved.
As a workaround, I will recommend you using another keymap instead.
I think you can use exists('b:_codeium_completions')
.
inoremap <silent><expr> <Right> exists('b:_codeium_completions') ? codeium#Accept() : "\<Right>"
@Shougo Hi, is it possible to translate the code into Lua? Specifically, I would like to know how to access the buffer variable b:_codeium_completions
in Lua from Neovim. This could help me too, #124.
update: Nevermind, I just found that it can be accessed via vim.b.
. I guess the API you added in #137 is for this?
I guess the API you added in https://github.com/Exafunction/codeium.vim/pull/137 is for this?
It is not related. I have added the API for my completion plugin.
inoremap
exists('b:_codeium_completions') ? codeium#Accept() : "\ "
Thank you, but sadly this does not work. When I press right (in insert mode), it seems to add a tab (4 spaces)...
Hm...
It works for me.
inoremap <silent><expr> <Right>
\ exists('b:_codeium_completions') && !empty(get(b:_codeium_completions, 'items', [])) ?
\ codeium#Accept() : "\<Right>"
inoremap <silent><expr> <Right> \ exists('b:_codeium_completions') && !empty(get(b:_codeium_completions, 'items', [])) ? \ codeium#Accept() : "\<Right>"
Yes, this works as expected! Thank you Shougo!!
inoremap <silent><expr> <Right> \ exists('b:_codeium_completions') && !empty(get(b:_codeium_completions, 'items', [])) ? \ codeium#Accept() : "\<Right>"
i'm not familiar with vim and lua. does anyone know how can i config this in lua?
For Copilot, I have the following keymap:
imap <silent><script><expr> <Right> copilot#Accept("<Right>")
How would I translate that for Codeium? I tried changing "copilot" for "codeium", as shown below, but it does not work..
imap <silent><script><expr> <Right> codeium#Accept("<Right>")
Any help would be appreciated. I want to use the Right arrow key as keymap for accepting the suggestion..