When setting up my Vim environment for a new language, two necessary configurations I need are auto formatting and jump to definition. These are the basics I installed to setup my environment for Rust, but note that these configurations will give you a wealth of other features not specified here.
- Install rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
2. Install rustup components
rustup component add rust-src
rustup component add rustfmt
rustup component add rust-analyzer
# this installs to a different path so may require, see https://rust-analyzer.github.io/manual.html#rust-analyzer-language-server-binary
# ln /home/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rust-analyzer /home/.cargo/bin
3. Install ALE
Plug 'dense-analysis/ale'nnoremap <C-]> :ALEGoToDefinition<cr>
nnoremap <C-[> :ALEFindReferences<cr>
nnoremap <C-h> :ALEHover<cr>let g:ale_linters = {'rust':['analyzer']}
4. Install Rust.vim
Plug 'rust-lang/rust.vim'