0

I was using Coc with Neovim and it seemed to work perfectly fine. So I got this new company laptop and after installing Neovim and copying my init.vim config the autocomplete(Tab and enter ) stopped working. A message started popping up that Coc now uses popup menu so I needed to re-set my Tab and Cr keys to make it work.

So I researched a lot on the forums and Coc documentation and was able to make Tab and work atleast partially. The problem is autocomplete works only when it is Showing autoimport (I'm using coc-tsserver) and then it autoimports and autocompletes. Other than that I can keep bashing my Enter it does nothing. I have tried various config from the page https://github.com/neoclide/coc.nvim/wiki/Completion-with-sources but none seem to work. Please help me. I am still new to VIm but after using it for a few months it has become indispensable. I have tried for 2 days and my work is pending. I have to use stupid VS code meanwhile.

Note- Autocomplete with AutoImport works only when I have this in my rc file

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

romainl
  • 186,200
  • 21
  • 280
  • 313

1 Answers1

1

Based on @Jon Deaton answer you may try to replace this

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

with this:

inoremap <silent><expr> <TAB> coc#pum#visible() ? coc#pum#confirm() : "\<C-g>u\<TAB>"