本来想在windows xp下搭建GVim+Python+YouCompleteMe的开发环境,可惜YouCompleteMe太复杂难用了,还得自己编译,对windows支持的不好,从作者官网下载的编译好的文件也不能正常使用。不过在此过程中倒是搭建好了vundle插件管理工具。于是在此做个简单的记录。
1.下载并安装Gvim,最好安装目录不要带有空格,有些插件对空格支持的不好。
安装好的路径是 D:\Vim , Vim文件夹中包含两个文件夹和一个文件,vim74是主程序文件夹,vimfiles是为了方便配置插件的文件夹,_vimrc是vim的配置文件。
2.下面是vundle官网windows 下安装vundle的方法:
官方链接点击打开链接,自己的英语不好,就不翻译了。
3.比较重要的是在 Different File Names 一节中,
cd %USERPROFILE% 这里其实打开的是C:\Documents and Settings\Administrator(这里可能不是Administrator,而是你的用户名)
git clone https://github.com/gmarik/vundle.git vimfiles/bundle/vundle 这一步用git将vundle的所有文件都下载配置在C:\Documents and Settings\Administrator\vimfiles\bundle\vundle中了
cd D:\Vim
git clone https://github.com/gmarik/vundle.git vimfiles/bundle/vundle
4.接下来一步Edit The Config For Windows中,首先将quick-start 中第三步的代码粘贴到_vimrc文件中,并做如下修改
改变
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
为
set rtp+=~/vimfiles/bundle/vundle/ 这个 ~ 代表的应该就是用户目录C:\Documents and Settings\Administrator
let path='~/vimfiles/bundle'
call vundle#rc(path)
所以我按照这个配置弄完了之后就不成功,搜了半天才发现是路径问题,改成这样就好了
set rtp+=$VIM/vimfiles/bundle/vundle/
let path='$VIM/vimfiles/bundle'
call vundle#rc(path)
5.下一步中提到有可能配置文件中的斜杠 / 有问题,把 vim/ 的斜杠去掉
Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}
Bundle 'rstacruz/sparkup', {'rtp': 'vim'}
注意官网的 Bundle 命令已经 变成了 Plugin
6.在配置文件默认的插件安装时,其中一行
Plugin 'file:///home/gmarik/path/to/plugin'
可能会有问题,这个好像是自己本地开发的plugin的目录,问题可能还是出在file://的路径上,不管它,把它用行首双引号注释掉。
7.最后 启动 GVim, 输入命令
:PluginInstall
等待插件下载安装好了就行了。
下面是代码。
"Vundle setting
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=$VIM/vimfiles/bundle/vundle/
"call vundle#rc()
" alternatively, pass a path where Vundle should install plugins
let path = '$VIM/vimfiles/bundle'
call vundle#rc(path)
" let Vundle manage Vundle, required
Plugin 'gmarik/vundle'
" The following are examples of different formats supported.
" Keep Plugin commands between here and filetype plugin indent on.
" scripts on GitHub repos
Plugin 'tpope/vim-fugitive'
Plugin 'Lokaltog/vim-easymotion'
Plugin 'tpope/vim-rails.git'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup', {'rtp': 'vim'}
" scripts from http://vim-scripts.org/vim/scripts.html
Plugin 'L9'
Plugin 'FuzzyFinder'
" scripts not on GitHub
Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
"Plugin 'file:///home/gmarik/path/to/plugin'
" ...
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - list configured plugins
" :PluginInstall(!) - install (update) plugins
" :PluginSearch(!) foo - search (or refresh cache first) for foo
" :PluginClean(!) - confirm (or auto-approve) removal of unused plugins
"
" see :h vundle for more details or wiki for FAQ
" NOTE: comments after Plugin commands are not allowed.
" Put your stuff after this line