[关闭]
@rmokerone 2015-08-03T06:48:38.000000Z 字数 3345 阅读 567

vim install and configure for Ubuntu 15.04

vim


​重新安装了下ubuntu15.04,当然以前的vim配置环境已经没有了。需要重新配置,因为每次配置都是比较繁琐的过程,所以这次就记录下来,已备下次使用。
环境信息:
环境信息

0x01安装vim

个人比较喜欢从源码进行编译.
vim官方地址使用The Vim Mercurial repository来提供unix环境vim源码的维护。下载方式为:

  1. hg clone https://vim.googlecode.com/hg/ vim

不过我没有安装过hg,再加上googlecode已经停止维护了。现在大多数的源码托管已经从googlecode转移到了github上了。所以,再github上也很容易能够找到vim源码,并且该repository还比较活跃。使用如下命令将源码git到本地。

  1. git clone https://github.com/vim/vim.git

因为某些墙的原因,git的速度比较慢,请耐心等待ing.与此同时这部分时间可以用来安装vim需要的支持软件。使用命令:

  1. sudo apt-get install libncurses5-dev libgnome2-dev libgnomeui-dev \
  2. > libgtk2.0-dev libatk1.0-dev libbonoboui2-dev \
  3. > libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev \
  4. > ruby-dev mercurial

安装支持软件
输入y确认进行安装。
支持软件安装完成后,还要进行等待ing...
git cloneing
经过漫长的等待vim的源码就会下载下来了.
下载完成
源码下载下来后就需要进行编译安装了。
因为我需要使用YCM插件,所以就再编译的时候加入python和clang.

  1. ./configure --with-features=huge \
  2. --enable-multibyte \
  3. --enable-rubyinterp \
  4. --enable-pythoninterp \
  5. --with-python-config-dir=/usr/lib/python2.7/config \
  6. --enable-perlinterp \
  7. --enable-luainterp \
  8. --enable-gui=gtk2 --enable-cscope --prefix=/usr
  9. make VIMRUNTIMEDIR=/usr/share/vim/vim74
  10. sudo make install

命令执行完成后,验证下:

  1. masong@hydra:~/Tools/vim$ vim --version
  2. VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug 3 2015 13:27:38)
  3. Included patches: 1-803
  4. Compiled by masong@hydra
  5. Huge version with GTK2 GUI. Features included (+) or not (-):
  6. +acl +farsi +mouse_netterm +syntax
  7. +arabic +file_in_path +mouse_sgr +tag_binary
  8. +autocmd +find_in_path -mouse_sysmouse +tag_old_static
  9. +balloon_eval +float +mouse_urxvt -tag_any_white
  10. +browse +folding +mouse_xterm -tcl
  11. ++builtin_terms -footer +multi_byte +terminfo
  12. +byte_offset +fork() +multi_lang +termresponse
  13. +cindent +gettext -mzscheme +textobjects
  14. +clientserver -hangul_input +netbeans_intg +title
  15. +clipboard +iconv +path_extra +toolbar
  16. +cmdline_compl +insert_expand -perl +user_commands
  17. +cmdline_hist +jumplist +persistent_undo +vertsplit
  18. +cmdline_info +keymap +postscript +virtualedit
  19. +comments +langmap +printer +visual
  20. +conceal +libcall +profile +visualextra
  21. +cryptv +linebreak +python +viminfo
  22. +cscope +lispindent -python3 +vreplace
  23. +cursorbind +listcmds +quickfix +wildignore
  24. +cursorshape +localmap +reltime +wildmenu
  25. +dialog_con_gui -lua +rightleft +windows
  26. +diff +menu +ruby +writebackup
  27. +digraphs +mksession +scrollbind +X11
  28. +dnd +modify_fname +signs -xfontset
  29. -ebcdic +mouse +smartindent +xim
  30. +emacs_tags +mouseshape -sniff +xsmp_interact
  31. +eval +mouse_dec +startuptime +xterm_clipboard
  32. +ex_extra -mouse_gpm +statusline -xterm_save
  33. +extra_search -mouse_jsbterm -sun_workshop +xpm

至此vim编译安装就算是完成了。
下一步使配置。

0x02配置vim

原来我的vim配置文件备份再github上。下载clone下来,直接clone到~/目录下。

  1. git clone https://github.com/rmokerone/vim.git

先看下~/目录下面的情况

  1. masong@hydra:~$ ls -al |grep vim
  2. drwxrwxr-x 5 masong masong 4096 8 3 11:50 vim
  3. -rw------- 1 masong masong 511 8 3 13:29 .viminfo

其中vim文件夹是我刚才git下来的。现在需要配置文件,一般来讲需要配置两个,一个使.vimrc文件和.vim文件夹。因为我的vim文件夹下面有vimrc文件,下面建立个软链接就可以了。

  1. masong@hydra:~$ ln -s vim/vimrc .vimrc
  2. masong@hydra:~$ ln -s vim/ .vim
  3. masong@hydra:~$ ll |grep vim
  4. drwxrwxr-x 5 masong masong 4096 8 3 11:50 vim/
  5. -rw------- 1 masong masong 511 8 3 13:29 .viminfo
  6. lrwxrwxrwx 1 masong masong 9 8 3 13:39 .vimrc -> vim/vimrc

软链接建立成功,现在打开vim试下。

  1. masong@hydra:~$ vim
  2. Error detected while processing /home/masong/.vimrc:
  3. line 2:
  4. E117: Unknown function: pathogen#infect
  5. E15: Invalid expression: pathogen#infect()
  6. line 48:
  7. E492: Not an editor command: :Helptags
  8. line 52:
  9. E185: Cannot find color scheme 'solarized'
  10. Press ENTER or type command to continue

提示错误,查看下,进行错误修改。

  1. masong@hydra:~/vim/bundle/vim-pathogen$ ls -al
  2. total 8
  3. drwxrwxr-x 2 masong masong 4096 8 3 11:48 .
  4. drwxrwxr-x 8 masong masong 4096 8 3 11:48 ..

发现vim-pathogen是空的,一定使上次忘了更新了。重新下载下就好了。
下载完后就可以使用了.
安装完成

0x03安装vim-YCM

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注