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.

romainl
  • 186,200
  • 21
  • 280
  • 313
piedpipr
  • 155
  • 2
  • 7
  • So `ctrl-n` or down arrow key doesn't work? – svlasov Aug 24 '23 at 00: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. – piedpipr Aug 24 '23 at 01:09

1 Answers1

-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.

fannheyward
  • 18,599
  • 12
  • 71
  • 109