Skip to content

My attempt to make neovim more rust friendly from an IDE perspective while trying to not do all of the things!

License

Notifications You must be signed in to change notification settings

casonadams/nvim-rust-ide

Repository files navigation

vim-rust-ide

Alt text

My attempt to make vim more rust friendly from an IDE perspective

These instructions get neovim setup for

  • Autocompletion
  • Live-linting
  • Autoformatting
  • Syntax-highlighting
  • hover docs
  • jump to def

Install the rust toolchains

Install rustup Add ~/.cargo/bin to PATH echo "~/.cargo/bin" >> ~/.bashrc

RLS

Rust Language Server RLS

rustup toolchain install stable
rustup toolchain install nightly
rustup default stable
rustup component add rls rust-analysis rust-src

Racer

Rust Code Completion utility Racer

cargo +nightly install racer

It is recommeded to set RUST_SRC_PATH for speed it isn't needed

echo "export RUST_SRC_PATH=\"$(rustc --print sysroot)/lib/rustlib/src/rust/src\"" >> ~/.bashrc

rustfmt

Format Rust code rustfmt

cargo install rustfmt-nightly

python modules

Most operating systems come with python installed Python

Need to have msgpack >= 1.0.0

python3 -m pip install -U pynvim msgpack

nodejs install

coc.nvim uses nodejs. Some may not like nodejs installed. If that is the case use deoplete. There are some commits in the repo that have examples of how to use it with rust. coc.nvim

curl -sL install-node.now.sh/lts | bash

Neovim

vim-plug

curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

Install neovim Neovim

Update ~/.config/nvim/init.vim using init.vim file in source repo

cp init.vim ~/.config/nvim/

Install patched powerline font (Optional)

SauceCodePro

Start neovim

nvim

Inside neovim install plugins :PlugInstall Inside neovim install Coc :CocInstall

Alacritty terminal (Optional)

Install alacritty terminal Alacritty

Copy alacritty.yml from repo

cp alacritty.yml ~/.config/alacritty/

Tmux (Optional)

Install tmux Tmux

Copy tmux.conf from repo

cp tmux.conf ~/.tmux.conf
tmux

ctrl+b I to install plugins ctrl+b r to reload tmux

Prettier Formatter (downside is it relies on editorconfig and not rustfmt.toml)

prettier cd ~/.config/coc/extensions

npm install coc-prettier

Open nvim :CocConfig

Update the file

{
  "coc.preferences.formatOnSaveFiletypes": ["*"]
}

Install other nice deps

  • bat
  • ripgrep
  • fd-find

Refs

Usage

Command Result
K show doc hover
gd go to def
gcc Line comment
F3 Toggle NERDTree
F2 Toggle Tagbar
F1 Update tags
SPACE = Buffer Next
SPACE - Buffer Previous

About

My attempt to make neovim more rust friendly from an IDE perspective while trying to not do all of the things!

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published