@rmokerone
2015-08-03T06:48:38.000000Z
字数 3345
阅读 567
vim
重新安装了下ubuntu15.04,当然以前的vim配置环境已经没有了。需要重新配置,因为每次配置都是比较繁琐的过程,所以这次就记录下来,已备下次使用。
环境信息:
个人比较喜欢从源码进行编译.
vim官方地址使用The Vim Mercurial repository来提供unix环境vim源码的维护。下载方式为:
hg clone https://vim.googlecode.com/hg/ vim
不过我没有安装过hg,再加上googlecode已经停止维护了。现在大多数的源码托管已经从googlecode转移到了github上了。所以,再github上也很容易能够找到vim源码,并且该repository还比较活跃。使用如下命令将源码git到本地。
git clone https://github.com/vim/vim.git
因为某些墙的原因,git的速度比较慢,请耐心等待ing.与此同时这部分时间可以用来安装vim需要的支持软件。使用命令:
sudo apt-get install libncurses5-dev libgnome2-dev libgnomeui-dev \
> libgtk2.0-dev libatk1.0-dev libbonoboui2-dev \
> libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev \
> ruby-dev mercurial
输入y确认进行安装。
支持软件安装完成后,还要进行等待ing...
经过漫长的等待vim的源码就会下载下来了.
源码下载下来后就需要进行编译安装了。
因为我需要使用YCM插件,所以就再编译的时候加入python和clang.
./configure --with-features=huge \
--enable-multibyte \
--enable-rubyinterp \
--enable-pythoninterp \
--with-python-config-dir=/usr/lib/python2.7/config \
--enable-perlinterp \
--enable-luainterp \
--enable-gui=gtk2 --enable-cscope --prefix=/usr
make VIMRUNTIMEDIR=/usr/share/vim/vim74
sudo make install
命令执行完成后,验证下:
masong@hydra:~/Tools/vim$ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug 3 2015 13:27:38)
Included patches: 1-803
Compiled by masong@hydra
Huge version with GTK2 GUI. Features included (+) or not (-):
+acl +farsi +mouse_netterm +syntax
+arabic +file_in_path +mouse_sgr +tag_binary
+autocmd +find_in_path -mouse_sysmouse +tag_old_static
+balloon_eval +float +mouse_urxvt -tag_any_white
+browse +folding +mouse_xterm -tcl
++builtin_terms -footer +multi_byte +terminfo
+byte_offset +fork() +multi_lang +termresponse
+cindent +gettext -mzscheme +textobjects
+clientserver -hangul_input +netbeans_intg +title
+clipboard +iconv +path_extra +toolbar
+cmdline_compl +insert_expand -perl +user_commands
+cmdline_hist +jumplist +persistent_undo +vertsplit
+cmdline_info +keymap +postscript +virtualedit
+comments +langmap +printer +visual
+conceal +libcall +profile +visualextra
+cryptv +linebreak +python +viminfo
+cscope +lispindent -python3 +vreplace
+cursorbind +listcmds +quickfix +wildignore
+cursorshape +localmap +reltime +wildmenu
+dialog_con_gui -lua +rightleft +windows
+diff +menu +ruby +writebackup
+digraphs +mksession +scrollbind +X11
+dnd +modify_fname +signs -xfontset
-ebcdic +mouse +smartindent +xim
+emacs_tags +mouseshape -sniff +xsmp_interact
+eval +mouse_dec +startuptime +xterm_clipboard
+ex_extra -mouse_gpm +statusline -xterm_save
+extra_search -mouse_jsbterm -sun_workshop +xpm
至此vim编译安装就算是完成了。
下一步使配置。
原来我的vim配置文件备份再github上。下载clone下来,直接clone到~/目录下。
git clone https://github.com/rmokerone/vim.git
先看下~/目录下面的情况
masong@hydra:~$ ls -al |grep vim
drwxrwxr-x 5 masong masong 4096 8月 3 11:50 vim
-rw------- 1 masong masong 511 8月 3 13:29 .viminfo
其中vim文件夹是我刚才git下来的。现在需要配置文件,一般来讲需要配置两个,一个使.vimrc文件和.vim文件夹。因为我的vim文件夹下面有vimrc文件,下面建立个软链接就可以了。
masong@hydra:~$ ln -s vim/vimrc .vimrc
masong@hydra:~$ ln -s vim/ .vim
masong@hydra:~$ ll |grep vim
drwxrwxr-x 5 masong masong 4096 8月 3 11:50 vim/
-rw------- 1 masong masong 511 8月 3 13:29 .viminfo
lrwxrwxrwx 1 masong masong 9 8月 3 13:39 .vimrc -> vim/vimrc
软链接建立成功,现在打开vim试下。
masong@hydra:~$ vim
Error detected while processing /home/masong/.vimrc:
line 2:
E117: Unknown function: pathogen#infect
E15: Invalid expression: pathogen#infect()
line 48:
E492: Not an editor command: :Helptags
line 52:
E185: Cannot find color scheme 'solarized'
Press ENTER or type command to continue
提示错误,查看下,进行错误修改。
masong@hydra:~/vim/bundle/vim-pathogen$ ls -al
total 8
drwxrwxr-x 2 masong masong 4096 8月 3 11:48 .
drwxrwxr-x 8 masong masong 4096 8月 3 11:48 ..
发现vim-pathogen是空的,一定使上次忘了更新了。重新下载下就好了。
下载完后就可以使用了.