Vim终极折腾

Edit


本篇从这里开始
跟我一起学习VIM - The Life Changing Editor
然后到这里进入高潮
spf13/spf13-vim
第一篇看似是一篇普普通通介绍Vim插件的博客文。但是他在介绍一些顶级插件的同时,引入了spf13这个GitHub上的开源项目。这其实就是一个很全的vimrc配置。玩家可以根据自己的需求进行定制。这一下打开了潘多拉魔盒,本来怕麻烦折腾的我,一下就入坑了。

" Use fork vimrc if available {
if filereadable(expand("~/.vimrc.fork"))
source ~/.vimrc.fork
endif
" }

" Use local vimrc if available {
if filereadable(expand("~/.vimrc.local"))
source ~/.vimrc.local
endif
" }

" Use local gvimrc if available and gui is running {
if has('gui_running')
if filereadable(expand("~/.gvimrc.local"))
source ~/.gvimrc.local
endif
endif
" }
  • .vimrc.before - spf13-vim before configuration
  • .vimrc.before.fork - fork before configuration
  • .vimrc.before.local - before user configuration
  • .vimrc.bundles - spf13-vim bundle configuration
  • .vimrc.bundles.fork - fork bundle configuration
  • .vimrc.bundles.local - local user bundle configuration
  • .vimrc - spf13-vim vim configuration
  • .vimrc.fork - fork vim configuration
  • .vimrc.local - local user configuration

低端玩家可以用.vimrc.*.local来做本地化定制,高端玩家可以fork repo,然后添加自己的.vimrc.*.fork做定制,然后commit,然后所有你的Vim环境就都可以用到这一份配置了。
完工后的Vim看起来这样

问题

powerline fonts

Windows

要完成这样的效果,最纠结的就是powerline的字体。如果字体不正确,是没法出现这样的小尖角样式的。

" .vimrc.bundles
Bundle 'powerline/fonts'

所有的字体文件都被安装到$HOME\.vim\bundle\fonts\。然后我们再调用其中的power script脚本install.ps1,就会安装到系统字体目录。然后在Vim中选择对应的字体就好了。

Linux

在Linux,尤其是通过putty访问Linux的时候就没这么简单了。因为我全是用putty ssh访问Linux,所以一开始以为是putty的问题,网上搜出来一堆,都是这样的解释。

  1. Download the patched fonts. I chose DejaVuSansMono as my font since I like it most.
  2. Install this font in Windows to make it accessible for all programs.
  3. Open PuTTY and make changes to the settings:
  4. Under appearance select the patched font
  5. Select font quality Clear Type
  6. Under Translation select character set UTF-8
  7. Apply settings and restart the PuTTY session

但按照这样做完,却并不起效果。后来发现在Linux本机的图形界面下用Terminal开Vim也是一样的情况。
在终端的profile中配置字体还是一样,没有效果。
然后找到Powerline的官方文档——Powerline

  1. Move the patched font to a valid X font path. Valid font paths can be listed with xset q:

    mv 'SomeFont for Powerline.otf' ~/.fonts/

  2. Update font cache for the path the font was moved to (root priveleges may be needed for updating font cache for some paths):

    fc-cache -vf ~/.fonts/

颇受启发。
经过分析,得出原因是:

  1. Linux的桌面系统分为GNome,KDE等等。不同 的桌面系统所采用的字体目录是不同的。我们目前采用的字体目录在
[benzhou@plslx111 phx]$ xset q|grep font
catalogue:/etc/X11/fontpath.d,built-ins
  1. 不同的桌面环境也对应不同的终端,比如我们目前使用的就是KDE下的Konsole。
  2. 修改install.sh,将字体安装到对应的字体目录下,并刷新字体缓存
  3. 配置好Konsole
  4. putty下面一切完美

Update - 20170606
Linux上的字体安装始终不成功,在Terminal里面无法找到powerline字体。
最后的解决办法是,字体安装目录在/usr/share/fonts。把~/.vim/bundles/fonts/install.sh中的font_dir设置为对应的路径,再运行就OK了

字体问题

Windows下使用Courier New字体感觉怪怪的,原因是设置了let g:spf13_no_big_font,但因为后面采用了Source Code Pro for Powerline字体,所以就还是保持1。

neocomplete不支持

装完spf13并没有深究每一个插件的用法,偶尔看到对neocomplete的推荐,所以想试一试。在命令行中输入:NeoCompleteEnable,发现竟然不支持,原来neocomplete需要Vim对lua的支持。有两条路可以走:

  1. 安装vim-nox/vim-athena/vim-gtk/vim-gnome其中之一
  2. 自行编译Vim,并使能lua支持
    因为我们使用的发行版过于陈旧,上面提到的四个包都没有,所以只能走第二条路了。
    命令只有两条:
[benzhou@plslx111 vim]$ ./configure  --enable-rubyinterp \
--enable-pythoninterp \
--with-python-config-dir=/usr/bin/python2.6-config \ # 这一行python的配置也要对
--enable-perlinterp \
--enable-gui=gtk2 \
--enable-cscope \
--prefix=/usr/local \
--enable-luainterp \ # 下面两行最重要
--with-lua-prefix=/usr/bn #
[benzhou@plslx111 vim]$ make

编译Vim,在configure的时候,发现找不到lua的头文件,搜索一番,原因是没有安装lua-devel的包,于是在网上找了一个Fedora的RPM包,运行rpm -i安装,再configure就成了。
打开Vim命令行,运行echo has("lua"),结果是1,就大功告成了。

Error 523

在写Vim脚本的时候,一个很简单的函数出现了E523: Not allowed here。最后查明原因是在被map的命令中不能调用execute和normal函数,据说是为了安全。详情查看:help e523。下面是错误的.vimrc代码

function CscopeFind()
execute "cscope add cscope.out"
endfunction

nmap <space>s :<C-R>=CscopeFind()<CR>cscope find s <C-R>=expand('<cword>')<CR>

if 判断字符串

这是一个坑,和Python等主流语言不同,Vim脚本里,if后面的字符串会被强制转换成bool变量,再进行判断。而字符串对应的bool值为0。所以下面的echo语句永远也执行不到。

if (glob('/existing/file'))
echo ('yes')
endif

正确的写法应当是

if (!empty(glob('...'))
...
endif

插件

ctrlP

有了这个插件,cscope find f就没啥大用了。看官网的基本用法:

  • Press <F5> to purge the cache for the current directory to get new files, remove deleted files and apply new ignore options.
  • Press <c-f> and <c-b> to cycle between modes. (Ben: 在搜索文件,buffer, funky之间循环跳转)
  • Press <c-d> to switch to filename only search instead of full path. (Ben: 这个对于我比较有用,因为我们的路径太长)
  • Press <c-r> to switch to regexp mode.
  • Use <c-j>, <c-k> or the arrow keys to navigate the result list.
  • Use <c-t> or <c-v>, <c-x> to open the selected entry in a new tab or in a new split.
  • Use <c-n>, <c-p> to select the next/previous string in the prompt’s history.
  • Use <c-y> to create a new file and its parent directories.
  • Use <c-z> to mark/unmark multiple files and to open them.

目前我的配置

  • <leader>-f: 模糊搜索最近打开的文件(MRU)
  • <leader>-p: 模糊搜索当前目录及其子目录下的所有文件
  • <leader>fu: 进入当前文件的函数列表搜索
  • <leader>fU: 搜索当前光标下单词对应的函数

neocomplete

omni-complete

这是在Vim 7.0引入的自动补全功能,不依赖于任何插件。在没有neocomplete的时候,比如Windows下装neocomplete和ycm都很麻烦,就只能用原生的补全。其实也够用了,只是没有那么方便。
所有帮助命令入口:

:help ins-completion
:help compl-omni
:help ‘omnifunc’
:help i_CTRL-X_CTRL-O
:help ins-completion-menu
:help popupmenu-keys
:help ‘completeopt’
:help compl-omni-filetypes
:help omnicppcomplete.txt

看spf13的.vimrc中有这么一句:Automatically open and close the popup menu / preview window
本来以为omni-complete会像neocomplete一样自动弹出下拉菜单,但是经过一番Google和help研读。这个理解是错误的。

  • <C-N>/<C-P> 这就不提了,最基本的功能,N=next,P=previous
  • <CTRL-K> 字典补全,查询dictionary参数中对应的文件,进行补全
  • <CTRL-I> 当前文件和包含文件补全,I=include
  • <CTRL-]> tag补全
  • <CTRL-F> 文件名补全
  • <CTRL-D> 宏补全
  • <CTRL-V> Vim命令补全,V=Vim
  • <CTRL-U> User defined补全,U=User,补全函数通过set completefunc=xxx传入
  • <CTRL-O> omni补全,O=Omni,补全函数通过set omnifunc=xxx传入,这个Vim自带的脚本都已写好,spf13的vimrc也有参考设置了

UltiSnips

在折腾半天snipMate无果的情况下,转投UltiSnips。语法复杂度以及灵活性要强于snipMate。注意以下几点即可

  • UltiSnips搜索所有runtimepath下的UltiSnips目录中的.snippet结尾的文件
  • UltiSnips通过一个全局变量决定是否支持snipMate
  • UltiSnips用<tab>补全,与omni-complete冲突,不过omni-complete还有一种用法是<C-N>/<C-P>来切换选项,也凑合能用了
%23Vim%u7EC8%u6781%u6298%u817E%0A@%28%u5B66%u4E60%u7B14%u8BB0%29%5Bvim%5D%0A%u672C%u7BC7%u4ECE%u8FD9%u91CC%u5F00%u59CB%0A%5B%u8DDF%u6211%u4E00%u8D77%u5B66%u4E60VIM%20-%20The%20Life%20Changing%20Editor%5D%28http%3A//ju.outofmemory.cn/entry/79671%29%0A%u7136%u540E%u5230%u8FD9%u91CC%u8FDB%u5165%u9AD8%u6F6E%0A%5Bspf13/spf13-vim%5D%28https%3A//github.com/spf13/spf13-vim%29%0A%u7B2C%u4E00%u7BC7%u770B%u4F3C%u662F%u4E00%u7BC7%u666E%u666E%u901A%u901A%u4ECB%u7ECDVim%u63D2%u4EF6%u7684%u535A%u5BA2%u6587%u3002%u4F46%u662F%u4ED6%u5728%u4ECB%u7ECD%u4E00%u4E9B%u9876%u7EA7%u63D2%u4EF6%u7684%u540C%u65F6%uFF0C%u5F15%u5165%u4E86spf13%u8FD9%u4E2AGitHub%u4E0A%u7684%u5F00%u6E90%u9879%u76EE%u3002%u8FD9%u5176%u5B9E%u5C31%u662F%u4E00%u4E2A%u5F88%u5168%u7684vimrc%u914D%u7F6E%u3002%u73A9%u5BB6%u53EF%u4EE5%u6839%u636E%u81EA%u5DF1%u7684%u9700%u6C42%u8FDB%u884C%u5B9A%u5236%u3002%u8FD9%u4E00%u4E0B%u6253%u5F00%u4E86%u6F58%u591A%u62C9%u9B54%u76D2%uFF0C%u672C%u6765%u6015%u9EBB%u70E6%u6298%u817E%u7684%u6211%uFF0C%u4E00%u4E0B%u5C31%u5165%u5751%u4E86%u3002%0A%21%5BAlt%20text%5D%28./1490225064940.png%29%0A%u9488%u5BF9%u5404%u4E2A%u63D2%u4EF6%u7684%u914D%u7F6E%u90FD%u7528fold%u5904%u7406%u597D%u4E86%uFF0C%u4E00%u76EE%u4E86%u7136%u3002%u4F5C%u8005%u4E5F%u63D0%u4F9B%u597D%u4E86%u5B9A%u5236%u7684%u63A5%u53E3%0A%60%60%60%0A%22%20Use%20fork%20vimrc%20if%20available%20%7B%0A%20%20%20%20if%20filereadable%28expand%28%22%7E/.vimrc.fork%22%29%29%0A%20%20%20%20%20%20%20%20source%20%7E/.vimrc.fork%0A%20%20%20%20endif%0A%22%20%7D%0A%0A%22%20Use%20local%20vimrc%20if%20available%20%7B%0A%20%20%20%20if%20filereadable%28expand%28%22%7E/.vimrc.local%22%29%29%0A%20%20%20%20%20%20%20%20source%20%7E/.vimrc.local%0A%20%20%20%20endif%0A%22%20%7D%0A%0A%22%20Use%20local%20gvimrc%20if%20available%20and%20gui%20is%20running%20%7B%0A%20%20%20%20if%20has%28%27gui_running%27%29%0A%20%20%20%20%20%20%20%20if%20filereadable%28expand%28%22%7E/.gvimrc.local%22%29%29%0A%20%20%20%20%20%20%20%20%20%20%20%20source%20%7E/.gvimrc.local%0A%20%20%20%20%20%20%20%20endif%0A%20%20%20%20endif%0A%22%20%7D%0A%60%60%60%0A-%20.vimrc.before%20-%20spf13-vim%20before%20configuration%0A-%20.vimrc.before.fork%20-%20fork%20before%20configuration%0A-%20.vimrc.before.local%20-%20before%20user%20configuration%0A-%20.vimrc.bundles%20-%20spf13-vim%20bundle%20configuration%0A-%20.vimrc.bundles.fork%20-%20fork%20bundle%20configuration%0A-%20.vimrc.bundles.local%20-%20local%20user%20bundle%20configuration%0A-%20.vimrc%20-%20spf13-vim%20vim%20configuration%0A-%20.vimrc.fork%20-%20fork%20vim%20configuration%0A-%20.vimrc.local%20-%20local%20user%20configuration%0A%0A%u4F4E%u7AEF%u73A9%u5BB6%u53EF%u4EE5%u7528.vimrc.*.local%u6765%u505A%u672C%u5730%u5316%u5B9A%u5236%uFF0C%u9AD8%u7AEF%u73A9%u5BB6%u53EF%u4EE5fork%20repo%uFF0C%u7136%u540E%u6DFB%u52A0%u81EA%u5DF1%u7684.vimrc.%5C*.fork%u505A%u5B9A%u5236%uFF0C%u7136%u540Ecommit%uFF0C%u7136%u540E%u6240%u6709%u4F60%u7684Vim%u73AF%u5883%u5C31%u90FD%u53EF%u4EE5%u7528%u5230%u8FD9%u4E00%u4EFD%u914D%u7F6E%u4E86%u3002%0A%u5B8C%u5DE5%u540E%u7684Vim%u770B%u8D77%u6765%u8FD9%u6837%0A%21%5BAlt%20text%5D%28./1490225459173.png%29%0A%0A%23%23%20%u95EE%u9898%0A%23%23%23powerline%20fonts%0A%23%23%23%23Windows%0A%u8981%u5B8C%u6210%u8FD9%u6837%u7684%u6548%u679C%uFF0C%u6700%u7EA0%u7ED3%u7684%u5C31%u662Fpowerline%u7684%u5B57%u4F53%u3002%u5982%u679C%u5B57%u4F53%u4E0D%u6B63%u786E%uFF0C%u662F%u6CA1%u6CD5%u51FA%u73B0%u8FD9%u6837%u7684%u5C0F%u5C16%u89D2%u6837%u5F0F%u7684%u3002%0A%21%5BAlt%20text%5D%28./1490235175286.png%29%0A%u5B9E%u73B0%u8FD9%u4E2A%u6837%u5F0F%u7684%u63D2%u4EF6%u662F%60vim-airline%60%u3002%u5B83%u4F9D%u8D56%u4E8Epowerline%20fonts%u3002%u5728Windows%u4E0B%u8FD8%u662F%u6BD4%u8F83%u597D%u89E3%u51B3%u7684%u3002spf13%u5DF2%u7ECF%u5E2E%u6211%u4EEC%u88C5%u597D%u4E86powerline-fonts%u3002%0A%60%60%60%0A%22%20.vimrc.bundles%0ABundle%20%27powerline/fonts%27%0A%60%60%60%0A%u6240%u6709%u7684%u5B57%u4F53%u6587%u4EF6%u90FD%u88AB%u5B89%u88C5%u5230%60%24HOME%5C.vim%5Cbundle%5Cfonts%5C%60%u3002%u7136%u540E%u6211%u4EEC%u518D%u8C03%u7528%u5176%u4E2D%u7684power%20script%u811A%u672C%60install.ps1%60%uFF0C%u5C31%u4F1A%u5B89%u88C5%u5230%u7CFB%u7EDF%u5B57%u4F53%u76EE%u5F55%u3002%u7136%u540E%u5728Vim%u4E2D%u9009%u62E9%u5BF9%u5E94%u7684%u5B57%u4F53%u5C31%u597D%u4E86%u3002%0A%23%23%23%23Linux%0A%u5728Linux%uFF0C%u5C24%u5176%u662F%u901A%u8FC7putty%u8BBF%u95EELinux%u7684%u65F6%u5019%u5C31%u6CA1%u8FD9%u4E48%u7B80%u5355%u4E86%u3002%u56E0%u4E3A%u6211%u5168%u662F%u7528putty%20ssh%u8BBF%u95EELinux%uFF0C%u6240%u4EE5%u4E00%u5F00%u59CB%u4EE5%u4E3A%u662Fputty%u7684%u95EE%u9898%uFF0C%u7F51%u4E0A%u641C%u51FA%u6765%u4E00%u5806%uFF0C%u90FD%u662F%u8FD9%u6837%u7684%u89E3%u91CA%u3002%0A%3E1.%20Download%20the%20patched%20fonts.%20I%20chose%20DejaVuSansMono%20as%20my%20font%20since%20I%20like%20it%20most.%0A%3E2.%20Install%20this%20font%20in%20Windows%20to%20make%20it%20accessible%20for%20all%20programs.%0A%3E3.%20Open%20PuTTY%20and%20make%20changes%20to%20the%20settings%3A%0A%3E4.%20Under%20appearance%20select%20the%20patched%20font%0A%3E5.%20Select%20font%20quality%20Clear%20Type%0A%3E6.%20Under%20Translation%20select%20character%20set%20UTF-8%0A%3E7.%20Apply%20settings%20and%20restart%20the%20PuTTY%20session%0A%0A%u4F46%u6309%u7167%u8FD9%u6837%u505A%u5B8C%uFF0C%u5374%u5E76%u4E0D%u8D77%u6548%u679C%u3002%u540E%u6765%u53D1%u73B0%u5728Linux%u672C%u673A%u7684%u56FE%u5F62%u754C%u9762%u4E0B%u7528Terminal%u5F00Vim%u4E5F%u662F%u4E00%u6837%u7684%u60C5%u51B5%u3002%0A%u5728%u7EC8%u7AEF%u7684profile%u4E2D%u914D%u7F6E%u5B57%u4F53%u8FD8%u662F%u4E00%u6837%uFF0C%u6CA1%u6709%u6548%u679C%u3002%0A%u7136%u540E%u627E%u5230Powerline%u7684%u5B98%u65B9%u6587%u6863%u2014%u2014%5BPowerline%5D%28http%3A//powerline.readthedocs.io/en/master/installation/linux.html%23fonts-installation%29%0A%3E%201.%20Move%20the%20patched%20font%20to%20a%20valid%20X%20font%20path.%20Valid%20font%20paths%20can%20be%20listed%20with%20%60xset%20q%60%3A%0A%3E%0A%09%60mv%20%27SomeFont%20for%20Powerline.otf%27%20%7E/.fonts/%60%0A%09%0A%3E%202.%20Update%20font%20cache%20for%20the%20path%20the%20font%20was%20moved%20to%20%28root%20priveleges%20may%20be%20needed%20for%20updating%20font%20cache%20for%20some%20paths%29%3A%0A%3E%0A%09%60fc-cache%20-vf%20%7E/.fonts/%60%0A%09%0A%u9887%u53D7%u542F%u53D1%u3002%0A%u7ECF%u8FC7%u5206%u6790%uFF0C%u5F97%u51FA%u539F%u56E0%u662F%uFF1A%0A1.%20Linux%u7684%u684C%u9762%u7CFB%u7EDF%u5206%u4E3AGNome%uFF0CKDE%u7B49%u7B49%u3002%u4E0D%u540C%20%u7684%u684C%u9762%u7CFB%u7EDF%u6240%u91C7%u7528%u7684%u5B57%u4F53%u76EE%u5F55%u662F%u4E0D%u540C%u7684%u3002%u6211%u4EEC%u76EE%u524D%u91C7%u7528%u7684%u5B57%u4F53%u76EE%u5F55%u5728%0A%60%60%60bash%0A%5Bbenzhou@plslx111%20phx%5D%24%20xset%20q%7Cgrep%20font%0A%20%20catalogue%3A/etc/X11/fontpath.d%2Cbuilt-ins%0A%60%60%60%0A2.%20%u4E0D%u540C%u7684%u684C%u9762%u73AF%u5883%u4E5F%u5BF9%u5E94%u4E0D%u540C%u7684%u7EC8%u7AEF%uFF0C%u6BD4%u5982%u6211%u4EEC%u76EE%u524D%u4F7F%u7528%u7684%u5C31%u662FKDE%u4E0B%u7684Konsole%u3002%0A3.%20%u4FEE%u6539install.sh%uFF0C%u5C06%u5B57%u4F53%u5B89%u88C5%u5230%u5BF9%u5E94%u7684%u5B57%u4F53%u76EE%u5F55%u4E0B%uFF0C%u5E76%u5237%u65B0%u5B57%u4F53%u7F13%u5B58%0A4.%20%u914D%u7F6E%u597DKonsole%0A5.%20putty%u4E0B%u9762%u4E00%u5207%u5B8C%u7F8E%0A%0A%3E%20Update%20-%2020170606%0A%3E%20Linux%u4E0A%u7684%u5B57%u4F53%u5B89%u88C5%u59CB%u7EC8%u4E0D%u6210%u529F%uFF0C%u5728Terminal%u91CC%u9762%u65E0%u6CD5%u627E%u5230powerline%u5B57%u4F53%u3002%0A%3E%20%u6700%u540E%u7684%u89E3%u51B3%u529E%u6CD5%u662F%uFF0C%u5B57%u4F53%u5B89%u88C5%u76EE%u5F55%u5728/usr/share/fonts%u3002%u628A%7E/.vim/bundles/fonts/install.sh%u4E2D%u7684font_dir%u8BBE%u7F6E%u4E3A%u5BF9%u5E94%u7684%u8DEF%u5F84%uFF0C%u518D%u8FD0%u884C%u5C31OK%u4E86%0A%0A%23%23%23%u5B57%u4F53%u95EE%u9898%0AWindows%u4E0B%u4F7F%u7528Courier%20New%u5B57%u4F53%u611F%u89C9%u602A%u602A%u7684%uFF0C%u539F%u56E0%u662F%u8BBE%u7F6E%u4E86%60let%20g%3Aspf13_no_big_font%60%uFF0C%u4F46%u56E0%u4E3A%u540E%u9762%u91C7%u7528%u4E86Source%20Code%20Pro%20for%20Powerline%u5B57%u4F53%uFF0C%u6240%u4EE5%u5C31%u8FD8%u662F%u4FDD%u63011%u3002%0A%0A%23%23%23neocomplete%u4E0D%u652F%u6301%0A%u88C5%u5B8Cspf13%u5E76%u6CA1%u6709%u6DF1%u7A76%u6BCF%u4E00%u4E2A%u63D2%u4EF6%u7684%u7528%u6CD5%uFF0C%u5076%u5C14%u770B%u5230%u5BF9neocomplete%u7684%u63A8%u8350%uFF0C%u6240%u4EE5%u60F3%u8BD5%u4E00%u8BD5%u3002%u5728%u547D%u4EE4%u884C%u4E2D%u8F93%u5165%3ANeoCompleteEnable%uFF0C%u53D1%u73B0%u7ADF%u7136%u4E0D%u652F%u6301%uFF0C%u539F%u6765neocomplete%u9700%u8981Vim%u5BF9lua%u7684%u652F%u6301%u3002%u6709%u4E24%u6761%u8DEF%u53EF%u4EE5%u8D70%uFF1A%0A1.%20%u5B89%u88C5vim-nox/vim-athena/vim-gtk/vim-gnome%u5176%u4E2D%u4E4B%u4E00%0A2.%20%u81EA%u884C%u7F16%u8BD1Vim%uFF0C%u5E76%u4F7F%u80FDlua%u652F%u6301%0A%u56E0%u4E3A%u6211%u4EEC%u4F7F%u7528%u7684%u53D1%u884C%u7248%u8FC7%u4E8E%u9648%u65E7%uFF0C%u4E0A%u9762%u63D0%u5230%u7684%u56DB%u4E2A%u5305%u90FD%u6CA1%u6709%uFF0C%u6240%u4EE5%u53EA%u80FD%u8D70%u7B2C%u4E8C%u6761%u8DEF%u4E86%u3002%0A%u547D%u4EE4%u53EA%u6709%u4E24%u6761%uFF1A%0A%60%60%60bash%0A%5Bbenzhou@plslx111%20vim%5D%24%20./configure%20%20--enable-rubyinterp%20%5C%0A%09%09%09%09%09%09%20%20%20%20%20%20%20%20%20%20%20%20%20--enable-pythoninterp%20%5C%20%20%20%20%20%20%20%20%20%20%20%20%0A%09%09%09%09%09%09%20%20%20%20%20%20%20%20%20%20%20%20%20--with-python-config-dir%3D/usr/bin/python2.6-config%20%5C%20%23%20%u8FD9%u4E00%u884Cpython%u7684%u914D%u7F6E%u4E5F%u8981%u5BF9%20%20%20%20%20%20%20%20%0A%09%09%09%09%09%09%20%20%20%20%20%20%20%20%20%20%20%20%20--enable-perlinterp%20%5C%20%20%20%20%20%20%20%20%20%20%20%20%0A%09%09%09%09%09%09%20%20%20%20%20%20%20%20%20%20%20%20%20--enable-gui%3Dgtk2%20%5C%0A%09%09%09%09%09%09%20%20%20%20%20%20%20%20%20%20%20%20%20--enable-cscope%20%5C%0A%09%09%09%09%09%09%20%20%20%20%20%20%20%20%20%20%20%20%20--prefix%3D/usr/local%20%5C%20%20%20%20%20%20%20%20%20%20%20%20%0A%09%09%09%09%09%09%20%20%20%20%20%20%20%20%20%20%20%20%20--enable-luainterp%20%5C%20%20%20%20%20%20%20%20%20%20%23%20%u4E0B%u9762%u4E24%u884C%u6700%u91CD%u8981%20%0A%09%09%09%09%09%09%20%20%20%20%20%20%20%20%20%20%20%20%20--with-lua-prefix%3D/usr/bn%20%20%20%20%20%23%0A%5Bbenzhou@plslx111%20vim%5D%24%20make%0A%60%60%60%0A%u7F16%u8BD1Vim%uFF0C%u5728configure%u7684%u65F6%u5019%uFF0C%u53D1%u73B0%u627E%u4E0D%u5230lua%u7684%u5934%u6587%u4EF6%uFF0C%u641C%u7D22%u4E00%u756A%uFF0C%u539F%u56E0%u662F%u6CA1%u6709%u5B89%u88C5lua-devel%u7684%u5305%uFF0C%u4E8E%u662F%u5728%u7F51%u4E0A%u627E%u4E86%u4E00%u4E2AFedora%u7684RPM%u5305%uFF0C%u8FD0%u884Crpm%20-i%u5B89%u88C5%uFF0C%u518Dconfigure%u5C31%u6210%u4E86%u3002%0A%u6253%u5F00Vim%u547D%u4EE4%u884C%uFF0C%u8FD0%u884C%60echo%20has%28%22lua%22%29%60%uFF0C%u7ED3%u679C%u662F1%uFF0C%u5C31%u5927%u529F%u544A%u6210%u4E86%u3002%0A%0A%23%23%23Error%20523%0A%u5728%u5199Vim%u811A%u672C%u7684%u65F6%u5019%uFF0C%u4E00%u4E2A%u5F88%u7B80%u5355%u7684%u51FD%u6570%u51FA%u73B0%u4E86%60E523%3A%20Not%20allowed%20here%60%u3002%u6700%u540E%u67E5%u660E%u539F%u56E0%u662F%u5728%u88ABmap%u7684%u547D%u4EE4%u4E2D%u4E0D%u80FD%u8C03%u7528execute%u548Cnormal%u51FD%u6570%uFF0C%u636E%u8BF4%u662F%u4E3A%u4E86%u5B89%u5168%u3002%u8BE6%u60C5%u67E5%u770B%60%3Ahelp%20e523%60%u3002%u4E0B%u9762%u662F%u9519%u8BEF%u7684.vimrc%u4EE3%u7801%0A%60%60%60%0Afunction%20CscopeFind%28%29%0A%09execute%20%22cscope%20add%20cscope.out%22%0Aendfunction%0A%0Anmap%20%3Cspace%3Es%20%3A%3CC-R%3E%3DCscopeFind%28%29%3CCR%3Ecscope%20find%20s%20%3CC-R%3E%3Dexpand%28%27%3Ccword%3E%27%29%3CCR%3E%0A%60%60%60%0A%0A%23%23%23if%20%u5224%u65AD%u5B57%u7B26%u4E32%0A%u8FD9%u662F%u4E00%u4E2A%u5751%uFF0C%u548CPython%u7B49%u4E3B%u6D41%u8BED%u8A00%u4E0D%u540C%uFF0CVim%u811A%u672C%u91CC%uFF0Cif%u540E%u9762%u7684%u5B57%u7B26%u4E32%u4F1A%u88AB%u5F3A%u5236%u8F6C%u6362%u6210bool%u53D8%u91CF%uFF0C%u518D%u8FDB%u884C%u5224%u65AD%u3002%u800C%u5B57%u7B26%u4E32%u5BF9%u5E94%u7684bool%u503C%u4E3A0%u3002%u6240%u4EE5%u4E0B%u9762%u7684echo%u8BED%u53E5%u6C38%u8FDC%u4E5F%u6267%u884C%u4E0D%u5230%u3002%0A%60%60%60vim%0Aif%20%28glob%28%27/existing/file%27%29%29%0A%09echo%20%28%27yes%27%29%0Aendif%0A%60%60%60%0A%u6B63%u786E%u7684%u5199%u6CD5%u5E94%u5F53%u662F%0A%60%60%60vim%0Aif%20%28%21empty%28glob%28%27...%27%29%29%0A...%0Aendif%0A%60%60%60%0A%23%23%20%u63D2%u4EF6%0A%23%23%23ctrlP%0A%u6709%u4E86%u8FD9%u4E2A%u63D2%u4EF6%uFF0C%60cscope%20find%20f%60%u5C31%u6CA1%u5565%u5927%u7528%u4E86%u3002%u770B%u5B98%u7F51%u7684%u57FA%u672C%u7528%u6CD5%uFF1A%0A%3E-%20Press%20%60%3CF5%3E%60%20to%20purge%20the%20cache%20for%20the%20current%20directory%20to%20get%20new%20files%2C%20remove%20deleted%20files%20and%20apply%20new%20ignore%20options.%0A%3E-%20Press%20%60%3Cc-f%3E%60%20and%20%60%3Cc-b%3E%60%20to%20cycle%20between%20modes.%20%28Ben%3A%20%u5728%u641C%u7D22%u6587%u4EF6%uFF0Cbuffer%uFF0C%20funky%u4E4B%u95F4%u5FAA%u73AF%u8DF3%u8F6C%29%0A%3E-%20Press%20%60%3Cc-d%3E%60%20to%20switch%20to%20filename%20only%20search%20instead%20of%20full%20path.%20%28Ben%3A%20%u8FD9%u4E2A%u5BF9%u4E8E%u6211%u6BD4%u8F83%u6709%u7528%uFF0C%u56E0%u4E3A%u6211%u4EEC%u7684%u8DEF%u5F84%u592A%u957F%29%0A%3E-%20Press%20%60%3Cc-r%3E%60%20to%20switch%20to%20regexp%20mode.%0A%3E-%20Use%20%60%3Cc-j%3E%60%2C%20%60%3Cc-k%3E%60%20or%20the%20arrow%20keys%20to%20navigate%20the%20result%20list.%0A%3E-%20Use%20%60%3Cc-t%3E%60%20or%20%60%3Cc-v%3E%60%2C%20%60%3Cc-x%3E%60%20to%20open%20the%20selected%20entry%20in%20a%20new%20tab%20or%20in%20a%20new%20split.%0A%3E-%20Use%20%60%3Cc-n%3E%60%2C%20%60%3Cc-p%3E%60%20to%20select%20the%20next/previous%20string%20in%20the%20prompt%27s%20history.%0A%3E-%20Use%20%60%3Cc-y%3E%60%20to%20create%20a%20new%20file%20and%20its%20parent%20directories.%0A%3E-%20Use%20%60%3Cc-z%3E%60%20to%20mark/unmark%20multiple%20files%20and%20%3Cc-o%3E%20to%20open%20them.%0A%0A%u76EE%u524D%u6211%u7684%u914D%u7F6E%0A-%20%26lt%3Bleader%26gt%3B-f%3A%20%u6A21%u7CCA%u641C%u7D22%u6700%u8FD1%u6253%u5F00%u7684%u6587%u4EF6%28MRU%29%0A-%20%26lt%3Bleader%26gt%3B-p%3A%20%u6A21%u7CCA%u641C%u7D22%u5F53%u524D%u76EE%u5F55%u53CA%u5176%u5B50%u76EE%u5F55%u4E0B%u7684%u6240%u6709%u6587%u4EF6%0A-%20%26lt%3Bleader%26gt%3Bfu%3A%20%u8FDB%u5165%u5F53%u524D%u6587%u4EF6%u7684%u51FD%u6570%u5217%u8868%u641C%u7D22%0A-%20%26lt%3Bleader%26gt%3BfU%3A%20%u641C%u7D22%u5F53%u524D%u5149%u6807%u4E0B%u5355%u8BCD%u5BF9%u5E94%u7684%u51FD%u6570%0A%0A%21%5BAlt%20text%5D%28http%3A//zuyunfei.com/images/ctrlp-vim-demo.gif%20%22Ctrlp%u6F14%u793A%22%29%0A%0A%23%23%23neocomplete%0A%0A%23%23%23omni-complete%0A%u8FD9%u662F%u5728Vim%207.0%u5F15%u5165%u7684%u81EA%u52A8%u8865%u5168%u529F%u80FD%uFF0C%u4E0D%u4F9D%u8D56%u4E8E%u4EFB%u4F55%u63D2%u4EF6%u3002%u5728%u6CA1%u6709neocomplete%u7684%u65F6%u5019%uFF0C%u6BD4%u5982Windows%u4E0B%u88C5neocomplete%u548Cycm%u90FD%u5F88%u9EBB%u70E6%uFF0C%u5C31%u53EA%u80FD%u7528%u539F%u751F%u7684%u8865%u5168%u3002%u5176%u5B9E%u4E5F%u591F%u7528%u4E86%uFF0C%u53EA%u662F%u6CA1%u6709%u90A3%u4E48%u65B9%u4FBF%u3002%0A%u6240%u6709%u5E2E%u52A9%u547D%u4EE4%u5165%u53E3%uFF1A%0A%3E%3Ahelp%20ins-completion%0A%3Ahelp%20compl-omni%0A%3Ahelp%20%27omnifunc%27%0A%3Ahelp%20i_CTRL-X_CTRL-O%0A%3Ahelp%20ins-completion-menu%0A%3Ahelp%20popupmenu-keys%0A%3Ahelp%20%27completeopt%27%0A%3Ahelp%20compl-omni-filetypes%0A%3Ahelp%20omnicppcomplete.txt%20%0A%0A%u770Bspf13%u7684.vimrc%u4E2D%u6709%u8FD9%u4E48%u4E00%u53E5%uFF1A%60Automatically%20open%20and%20close%20the%20popup%20menu%20/%20preview%20window%60%0A%u672C%u6765%u4EE5%u4E3Aomni-complete%u4F1A%u50CFneocomplete%u4E00%u6837%u81EA%u52A8%u5F39%u51FA%u4E0B%u62C9%u83DC%u5355%uFF0C%u4F46%u662F%u7ECF%u8FC7%u4E00%u756AGoogle%u548Chelp%u7814%u8BFB%u3002%u8FD9%u4E2A%u7406%u89E3%u662F%u9519%u8BEF%u7684%u3002%0A%21%5BAlt%20text%5D%28./1490863953557.png%29%0A%u6240%u6709%u7684%u4E1C%u897F%u5E76%u4E0D%u4F1A%u81EA%u52A8%u6253%u5F00%uFF0C%u9700%u8981%u7528%60%3CC-X%3E%3CC-O%3E%60%u6216%u8005%60%3CC-N%3E%60%u6216%u8005%60%3CC-P%3E%60%u3002%u5176%u5B9E%60%3CC-X%3E%60%u8FDB%u5165%u4E00%u4E2A%u63D2%u5165%u6A21%u5F0F%u7684%u5B50%u6A21%u5F0F%uFF0C%u7136%u540E%u518D%u6309%u5176%u4ED6%u7684%u7EC4%u5408%u952E%uFF0C%u53EF%u4EE5%u6709%u5BF9%u5E94%u7684%u529F%u80FD%uFF0C%u6458%u8981%u5982%u4E0B%0A*%20%60%3CC-N%3E/%3CC-P%3E%60%20%20%20%20%20%20%20%u8FD9%u5C31%u4E0D%u63D0%u4E86%uFF0C%u6700%u57FA%u672C%u7684%u529F%u80FD%uFF0CN%3Dnext%uFF0CP%3Dprevious%0A*%20%60%3CCTRL-K%3E%60%20%20%20%20%20%20%u5B57%u5178%u8865%u5168%uFF0C%u67E5%u8BE2dictionary%u53C2%u6570%u4E2D%u5BF9%u5E94%u7684%u6587%u4EF6%uFF0C%u8FDB%u884C%u8865%u5168%0A*%20%60%3CCTRL-I%3E%60%20%20%20%20%20%20%u5F53%u524D%u6587%u4EF6%u548C%u5305%u542B%u6587%u4EF6%u8865%u5168%uFF0CI%3Dinclude%0A*%20%60%3CCTRL-%5D%3E%60%20%20%20%20%20%20tag%u8865%u5168%0A*%20%60%3CCTRL-F%3E%60%20%20%20%20%20%20%u6587%u4EF6%u540D%u8865%u5168%0A*%20%60%3CCTRL-D%3E%60%20%20%20%20%20%20%u5B8F%u8865%u5168%0A*%20%60%3CCTRL-V%3E%60%20%20%20%20%20%20Vim%u547D%u4EE4%u8865%u5168%uFF0CV%3DVim%0A*%20%60%3CCTRL-U%3E%60%20%20%20%20%20%20User%20defined%u8865%u5168%uFF0CU%3DUser%uFF0C%u8865%u5168%u51FD%u6570%u901A%u8FC7%60set%20completefunc%3Dxxx%60%u4F20%u5165%0A*%20%60%3CCTRL-O%3E%60%20%20%20%20%20%20omni%u8865%u5168%uFF0CO%3DOmni%uFF0C%u8865%u5168%u51FD%u6570%u901A%u8FC7%60set%20omnifunc%3Dxxx%60%u4F20%u5165%uFF0C%u8FD9%u4E2AVim%u81EA%u5E26%u7684%u811A%u672C%u90FD%u5DF2%u5199%u597D%uFF0Cspf13%u7684vimrc%u4E5F%u6709%u53C2%u8003%u8BBE%u7F6E%u4E86%0A%0A%23%23%23UltiSnips%0A%u5728%u6298%u817E%u534A%u5929snipMate%u65E0%u679C%u7684%u60C5%u51B5%u4E0B%uFF0C%u8F6C%u6295UltiSnips%u3002%u8BED%u6CD5%u590D%u6742%u5EA6%u4EE5%u53CA%u7075%u6D3B%u6027%u8981%u5F3A%u4E8EsnipMate%u3002%u6CE8%u610F%u4EE5%u4E0B%u51E0%u70B9%u5373%u53EF%0A-%20UltiSnips%u641C%u7D22%u6240%u6709runtimepath%u4E0B%u7684UltiSnips%u76EE%u5F55%u4E2D%u7684.snippet%u7ED3%u5C3E%u7684%u6587%u4EF6%0A-%20UltiSnips%u901A%u8FC7%u4E00%u4E2A%u5168%u5C40%u53D8%u91CF%u51B3%u5B9A%u662F%u5426%u652F%u6301snipMate%0A-%20UltiSnips%u7528%60%3Ctab%3E%60%u8865%u5168%uFF0C%u4E0Eomni-complete%u51B2%u7A81%uFF0C%u4E0D%u8FC7omni-complete%u8FD8%u6709%u4E00%u79CD%u7528%u6CD5%u662F%60%3CC-N%3E%60/%60%3CC-P%3E%60%u6765%u5207%u6362%u9009%u9879%uFF0C%u4E5F%u51D1%u5408%u80FD%u7528%u4E86%0A%0A