- Install Coc (via vim-plug, for instance). Requires nodejs.
Plug 'neoclide/coc.nvim', {'branch': 'release'}
- Install
rust-src
. For ubuntu:
sudo apt-get install rust-src
-
:CocInstall coc-rust-analyzer
-
Some useful key bindings (copied from somewhere long time ago):
" Remap keys for gotos
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> K :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
nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr>
- In case of problems with Coc or coc-rust-analyzer there is a Vim command which may shed some light:
:CocOpenLog