Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Racer support for Vim

License

NotificationsYou must be signed in to change notification settings

racer-rust/vim-racer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This plugin allows vim to useRacer for Rust code completion and navigation.

Note: Active development on vim-racer has stopped. The only future changeswill be bug fixes. You should use LSP plugins(vim-lsp, nvim-lspconfig)instead.

Installation

  1. Build / InstallRacer

  2. Install using Pathogen, Vundle or NeoBundle. Or, copyftplugin/rust_racer.vim into your~/.vim/plugin directory.

Vundle users:

Plugin 'racer-rust/vim-racer'

NeoBundle users:

NeoBundle 'racer-rust/vim-racer'

vim-plug users:

Plug 'racer-rust/vim-racer'

Pathogen users:

git clone --depth=1 https://github.com/racer-rust/vim-racer.git ~/.vim/bundle/vim-racer
  1. Addg:racer_cmd to your.vimrc. It contains full path toracerexecutable file. Variableg:racer_cmd is optional. You do not need to usethis variable if the executable file is in a directory that is specified in$PATH, else you should specified full path toracer executable binaryfile in thisg:racer_cmd. Also it's worth turning on 'hidden' mode forbuffers otherwise you need to save the current buffer every time you do agoto-definition. E.g.:
set hiddenlet g:racer_cmd = "/home/user/.cargo/bin/racer"
  1. If you want completions to show the complete function definition (e.g. itsarguments and return type), enable the experimental completer:
let g:racer_experimental_completer = 1
  1. If you want to insert the parenthesis in the completion:
let g:racer_insert_paren = 1

Example Mappings

vim-racer enablesC-x-C-o to search for completions and provides several<Plug> mappings for source code navigation. These mappings are not enabled bydefault but you can easily use them by adding the following lines to your.vimrc (Orinit.vim in case of Neovim).

For example, with the following mappings you can navigate to the identifierunder the cursor and open it on the current buffer, on an horizontal orvertical split, on a new tab, or go straight to the documentation:

augroup Racer    autocmd!    autocmd FileType rust nmap <buffer> gd         <Plug>(rust-def)    autocmd FileType rust nmap <buffer> gs         <Plug>(rust-def-split)    autocmd FileType rust nmap <buffer> gx         <Plug>(rust-def-vertical)    autocmd FileType rust nmap <buffer> gt         <Plug>(rust-def-tab)    autocmd FileType rust nmap <buffer> <leader>gd <Plug>(rust-doc)    autocmd FileType rust nmap <buffer> <leader>gD <Plug>(rust-doc-tab)augroup END

About

Racer support for Vim

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors46


[8]ページ先頭

©2009-2025 Movatter.jp