CoC, the Conqueror of Completion also deserves a mention. It is very advanced, comparable to VSCode's Intellisense, with extensions tailored to each language. It works with Vim 8 and with Neovim.
If you are not using a plugin manager, then the initial setup may take a little effort: You will need node
installed, then run npm run build
in CoC's home folder to get it ready.
After installing, you just need to tell CoC which languages you like to use. For example:
:CocInstall coc-tsserver coc-json coc-html coc-css
:CocInstall coc-python coc-perl
You can find a list here or a list with options here.
After that you are ready to go!
There is also a lot of optional configuration you can play with. Here are some of the things I am currently trying:
" Rename only in the current file (or maybe only in open buffers)
nmap <leader>rr <Plug>(coc-rename)
" Find all occurrences in project
nnoremap <leader>prw :CocSearch <C-R>=expand("<cword>")<CR><CR>
" The following are just some of the suggested settings from CoC's README.md {{{
set shortmess+=c
" Use `[g` and `]g` to navigate diagnostics
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Use K to show documentation in preview window.
nnoremap <silent> gh :call <SID>show_documentation()<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
" Symbol renaming.
nmap <leader>rn <Plug>(coc-rename)
I got interested in CoC after a friend shared this video:
Having said that, The Primagen seems to prefer using the Neovim LSP these days.