将VIM配置成强大的IDE(一)

将VIM配置成强大的IDE(一)

 

 

公司项目越来越多,eclipse打开加载的速度越来越慢。

突然想重拾VIM,回归原始coding状态。

然后就开始将VIM配置成一个IDE。

将VIM配置成IDE,不得不加载诸多插件,之前一直通过VIM官网获取script

缺点显然:1 下载麻烦;2 管理插件很管理

但vundle的问世,不得不说极大的方便了vim对插件的配制和管理。

所以开始安装vundle.

1. 首先准备好VIM,GIT工具

2.参照VUNDLE(https://github.com/gmarik/Vundle.vim/wiki/Vundle-for-Windows)配制了curl.cmd脚本,放置在GIT上面的cmd目录

3.拷贝配置文件,加入到_vimrc文件中

 

复制代码
set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/vimfiles/bundle/Vundle.vim
let path='~/vimfiles/bundle' call vundle#begin(path) " alternatively, pass a path where Vundle should install plugins "call vundle#begin('~/some/path/here') " let Vundle manage Vundle, required Plugin 'gmarik/Vundle.vim' " The following are examples of different formats supported. " Keep Plugin commands between vundle#begin/end. " plugin on GitHub repo Plugin 'tpope/vim-fugitive' " plugin from http://vim-scripts.org/vim/scripts.html Plugin 'L9' " Git plugin not hosted 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' " 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/'} " Avoid a name conflict with L9 Plugin 'user/L9', {'name': 'newL9'} " All of your Plugins must be added before the following line call vundle#end() " required filetype plugin indent on " required " To ignore plugin indent changes, instead use: "filetype plugin on " " Brief help " :PluginList - lists configured plugins " :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate " :PluginSearch foo - searches for foo; append `!` to refresh local cache " :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal " " see :h vundle for more details or wiki for FAQ " Put your non-Plugin stuff after this line
复制代码


问题来了,发现再次打开vim再次打开_vimrc文件时,提示:E117: Unknown function: vundle#begin

 

发现 “~” 是LINUX下面的写法,所以去掉“~/”

[代码1] 

set rtp+=~/vimfiles/bundle/Vundle.vim
let path='~/vimfiles/bundle'

改成:

[代码2]

set rtp+=vimfiles/bundle/Vundle.vim
let path='vimfiles/bundle'

 

再次用VIM打开_vimrc文件时,没有报错。(觉得解决了问题,好开森……)

 

发现,我打开其它相关文件时,依然报相同的ERROR……  查了好久……

 

将上面的[代码2]改成如下:

 [代码3]

set rtp+=$VIM/vimfiles/bundle/Vundle.vim
let path='$VIM/vimfiles/bundle'

然后才真正解决报错的问题。

 

 

分析下这个问题:

1. linux与win环境不同,[代码2] 解决了这个问题

2.VIM加载配置文件的问题:在打开某一文件时,VIM会将配置文件加载对当前路径,所以对于相对路径,就无法加载到相关函数。[通过配置,推测结论]

 

posted on 2014-10-01 23:32  徐明轩  阅读(2179)  评论(0)    收藏  举报

导航