-
Install racer
cargo install racer -
Fetch the Rust sourcecode
rustup component add rust-src -
Set the
RUST_SRC_PATHexport RUST_SRC_PATH="$(rustc --print sysroot)/lib/rustlib/src/rust/src" -
Test on the command line
racer complete std::io::B
-
Add to vim-plug
Plug 'racer-rust/vim-racer' -
Add
g:racer_cmdtoinit.vimset hidden let g:racer_cmd = "/path/to/racer/bin" -
To show the complete function definition (e.g. its arguments and return type)
let g:racer_experimental_completer = 1 -
GoTo definations
au FileType rust nmap gd <Plug>(rust-def) au FileType rust nmap gs <Plug>(rust-def-split) au FileType rust nmap gx <Plug>(rust-def-vertical) au FileType rust nmap <leader>gd <Plug>(rust-doc)