GitHub - ptzz/ctrlp-cmatcher: CtrlP C matching extension
source link: https://github.com/ptzz/ctrlp-cmatcher
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
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_files
option 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:
Regex
mode doesn't use C matching and probably will never use it. If you will use it with this extension it will fall back toctrlp.vim
matching 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.sh
-
On 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.sh
-
On 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.
- Edit your
.vimrc
:
Add following line:
let g:ctrlp_match_func = {'match' : 'matcher#cmatch' }
- All done!
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK