vim-racer


Ⅰ. 插件描述

Racer support for Vim

Ⅱ. 基本信息

创建日期:  2014-06-19
使用用户:  803
Github星:  535
插件作者:  racer-rust

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'racer-rust/vim-racer-you-belong-with-me'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'racer-rust/vim-racer-you-belong-with-me'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'racer-rust/vim-racer-you-belong-with-me'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/racer-rust/vim-racer

Ⅳ. 文档说明

# Vim Racer Plugin

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

Installation

  1. Build / Install Racer
  2. Install using Pathogen, Vundle or NeoBundle. Or, copy ftplugin/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. Add g:racer_cmd to your .vimrc. It contains full path to racer executable file.
    Variable g:racer_cmd is optional. You do not need to use this variable if the executable file is in a directory that is specified in $PATH, else you should specified full path to racer executable binary file in this g:racer_cmd. Also it's worth turning on 'hidden' mode for buffers otherwise you need to save the current buffer every time you do a goto-definition. E.g.:
set hidden
let g:racer_cmd = "/home/user/.cargo/bin/racer"
  1. If you want completions to show the complete function definition (e.g. its arguments and return type), enable the experimental completer:

    let g:racer_experimental_completer = 1
  2. If you want to insert the parenthesis in the completion:

    let g:racer_insert_paren = 1

Example Mappings

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

For example, with the following mappings you can navigate to the identifier under
the cursor and open it on the current buffer, on an horizontal or vertical 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)
augroup END

添加新评论