Ⅰ. 插件描述
CtrlP C matching extensionⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'jazzcore/ctrlp-cmatcher'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'jazzcore/ctrlp-cmatcher'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'jazzcore/ctrlp-cmatcher'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/jazzcore/ctrlp-cmatcher
Ⅳ. 文档说明
# CtrlP C matching extension
This is a ctrlp.vim extension which can be used to get different matching algorithm, written in C language with a small portion of Python (only to access C module).
This extension uses an adapted version of CommandT matching, big thanks to @wincent!
Advantages
- Matcher, written in C, can provide significant speed improvement when working on large projects with 10000+ files, e.g Metasploit. Dont forget to set
g:ctrlp_max_filesoption to 0 or 10000+ if you're working on such projects. - In some cases you can get more precise matching results ( e.g. when trying to match exact file name like
exe.rb)
Drawbacks
There are no real drawbacks, but I need to point out some things that may not work as you expected:
Regexmode doesn't use C matching and probably will never use it. If you will use it with this extension it will fall back toctrlp.vimmatching and may be slow on large projects.
Installation
Get extension files with your favorite method. Example for Vundle:
Plugin 'JazzCore/ctrlp-cmatcher'Compile C extension.
If you are getting any errors on this stage you can try the manual installation guide located here.On Linux/Unix systems:
First, get Python header files. Example for Debian/Ubuntu:[sudo] apt-get install python-dev
Then run the installation script:
cd ~/.vim/bundle/ctrlp-cmatcher
./install.shOn OS X (tested with 10.9.2 Mavericks):
First fix the compiler:
export CFLAGS=-Qunused-arguments export CPPFLAGS=-Qunused-arguments
Then run the installation script:
cd ~/.vim/bundle/ctrlp-cmatcher
./install.shOn Windows:
Installation is similar to Linux version, but it can be more complicated because of weird errors during compilation. First of all, make sure that you have ``python`` in your ``%PATH%``. Also you will need MinGW compiler suite installed. Dont forget to add ``C:\MinGW\bin`` to your ``%PATH%``. Then go to ``ctrlp-cmatcher`` dir and run the installation script:install_windows.bat
If you are getting __gcc: error: unrecognized command line option '-mno-cygwin'__ error, follow [this fix](http://stackoverflow.com/questions/6034390/compiling-with-cython-and-mingw-produces-gcc-error-unrecognized-command-line-o).
- Edit your
.vimrc:
Add following line:
let g:ctrlp_match_func = {'match' : 'matcher#cmatch' }- All done!