Use Vim as IDE - Rust
Hi everyone,
IMPORTANT:
This guide working for Ubuntu.
First, we have to be sure our system is up-to-date.
sudo apt-get update
sudo apt-get upgrade
Install RLS (Rust Language Server)
The RLS provides a server that runs in the background, providing IDEs, editors, and other tools with information about Rust programs. It supports functionality such as ‘goto definition’, symbol search, reformatting, and code completion, and enables renaming and refactorings.
# Install rustup
curl https://sh.rustup.rs -sSf | sh
rustup self update
Install components with rustup
rustup component add rls-preview --toolchain nightly
rustup component add rust-analysis --toolchain nightly
rustup component add rust-src --toolchain nightly
Install vim
sudo apt-get install vim
git
sudo apt-get install git
Vundle
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
Put this config of your .vimrc for use Vundle plugin manager.
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" Rust Plugin
Plugin 'rust-lang/rust.vim'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
Launch vim and type to install plugins
:PluginInstall
or install from command line
vim +PluginInstall +qall
Enable mouse support (Add this to your ~/.vimrc)
set mouse=a
Some NERDtree cheatsheets
CTRL-T: Toggle NERDtree
CTRL-ww: Switch between the files tab and main window
CTRL-n: Absolute numbering
Compile without opening another tab
# You can compile your project without opening another terminal instance.
:!cargo run --release