$ rustup component add rustfmt rls
$ rustup component add clippy
Modify ~/.vimrc
to include some/all of the following:
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-fugitive' " for git commands
Plug 'preservim/tagbar' " OMG essential
Plug 'rust-lang/rust.vim', {'for': 'rust'}
Plug 'racer-rust/vim-racer', {'for': 'rust'}
" Fuzzy finder
Plug 'junegunn/fzf', { 'do': './install --bin' }
Plug 'junegunn/fzf.vim'
Plug 'dense-analysis/ale'
let g:deoplete#enable_at_startup = 1
let g:ale_completion_enabled = 1
let g:ale_completion_autoimport = 1
let g:ale_update_tagstack = 1
let g:ale_rust_cargo_use_clippy = executable('cargo-clippy')
let g:ale_linters = {
\ 'rust': ['rls', 'cargo', 'rustc'],
\}
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'rust': ['rustfmt', 'trim_whitespace', 'remove_trailing_lines'],
\}
" Check test and example code too
let g:ale_rust_cargo_check_tests = 1
let g:ale_rust_cargo_check_examples = 1
call plug#end()
" press "gd" to jump to definition (and CTRL-t to return).
:au FileType rust nmap gd <Plug>(rust-def)