Giter VIP home page Giter VIP logo

nvim-rust-ide's Introduction

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

nvim-rust-ide's People

Contributors

casonadams avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

romeo555555

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.