Vim搭建Rust开发环境

jopen 8年前

1,使用vundle管理插件

vundle是vim的一个插件管理工具,基本上算是本类当中最为易用的了。 首先我们需要安装它

linux :

mkdir -p  ~/.vim/bundle/git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

2.启用rust支持

首先找到你的vimrc配置文件,然后在其中添加如下配置

set nocompatible                       " 关闭兼容模式filetype off                           " 关闭对文件类型的自动检测set rtp+=~/.vim/bundle/Vundle.vim      " 加入运行时路径call vundle#begin()                    " 初始化" 插件列表开始Plugin 'VundleVim/Vundle.vim'          " 插件列表1Plugin 'racer-rust/vim-racer'          " 插件列表1Plugin 'rust-lang/rust.vim'            " 插件列表1call vundle#end()                      " 完成filetype plugin indent on              " 打开文件类型检测

然后为了让配置生效,我们重启我们的vim,然后在vim里执行如下命令

打开 vim and run :PluginInstall或者 install from command line: vim +PluginInstall +qall

vundle会自动的去仓库里拉取我们需要的文件

3. 更多的配置

vimrc配置文件,然后在其中添加如下配置

let g:rustfmt_autosave = 1set hiddenlet g:racer_cmd = "<path-to-racer>/target/release/racer"let $RUST_SRC_PATH="<path-to-rust-srcdir>/src/"


来自: http://my.oschina.net/wxfvm/blog/604312