form https://sts10.github.io/2020/10/11/rust-neovim-setup.html
$ sudo apt install neovim
$ sudo apt install python-neovim
$ sudo apt install python3-neovim
$ rustup component add clippy
$ rustup component add rustfmt
$ rustup component add rust-src
$ git clone https://github.com/rust-analyzer/rust-analyzer.git && cd rust-analyzer
$
cargo xtask install --server
$ cd ..
$ rm -rf rust-analyzer
$ sudo apt-get install python3-pip && pip3 install pynvim neovim
In ~/.config/nvim/init.vim
~~~~~~
call plug#begin('~/.config/nvim/plugged')
" ... other plugins here
" autocomplete
if has('nvim')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
else
Plug 'Shougo/deoplete.nvim'
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
endif
" Language Server Client
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash install.sh',
\ }
let g:LanguageClient_serverCommands = {
\ 'rust': ['rust-analyzer'],
\ }
" For improved UI
Plug 'junegunn/fzf'
Plug 'rust-lang/rust.vim', { 'for': 'rust' }
call plug#end()
" ...
" Configure deoplete
let g:deoplete#enable_at_startup = 1
" note that if you are using Plug mapping you should not use `noremap` mappings.
nmap <F5> <Plug>(lcn-menu)
" Or map each action separately
" nmap <silent> <F2> <Plug>(lcn-rename)
autocmd FileType rust nmap <silent> gr <Plug>(lcn-rename)
" nmap <silent>K <Plug>(lcn-hover)
" nmap <silent> gd <Plug>(lcn-definition)
" Configure Rust formatter https://github.com/rust-lang/rust.vim#formatting-with-rustfmt
" autocmd Filetype rust nnoremap == :RustFmt<CR>
let g:rustfmt_autosave = 1
0 件のコメント:
コメントを投稿