0

enter image description here

I am using neoclide/coc.nvim plugin in vim on OSX

How do I select one of these suggestions, what is the command or shortcut to navigate and select them? I do not seem to have the ability to move around with vim standard navigation over the suggestion list window.

2
  • So ctrl-n or down arrow key doesn't work? Commented Aug 24, 2023 at 0:56
  • Yes, I forgot to ask chatGPT before then I got the answer anyway. So basically ctrl+p and ctrl+n both works, but thank you too. This was a silly question from my part. Commented Aug 24, 2023 at 1:09

1 Answer 1

1

<C-n> and <C-p> to select, also you can map <tab> to do selection, <CR> to confirm the suggestion.

function! CheckBackspace() abort
  let col = col('.') - 1
  return !col || getline('.')[col - 1]  =~# '\s'
endfunction

inoremap <silent><expr> <TAB>
      \ coc#pum#visible() ? coc#pum#next(1) :
      \ CheckBackspace() ? "\<Tab>" :
      \ coc#refresh()
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"

inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
                              \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"

Check :h coc-completion-default for the default mappings, and :h coc-completion-example for more.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.