ctrlp.vim ÷ home (original) (raw)

Full path fuzzy file, buffer, mru, tag, ... finder for Vim.

Screenshot: CtrlP in regex and full path mode with 3 files selected to open.
screenshot

Basic Usage:

Check :help ctrlp-commands and :help ctrlp-extensions for other commands.

Once CtrlP is open:

Run :help ctrlp-mappings or submit ? in CtrlP for more mapping help.

Basic Options:

let g:ctrlp_map = '<c-p>'  
let g:ctrlp_cmd = 'CtrlP'  
let g:ctrlp_working_path_mode = 'ra'  

'c' - the directory of the current file.
'r' - the nearest ancestor that contains one of these directories or files: .git .hg .svn .bzr _darcs, and your own root markers defined with the g:ctrlp_root_markers option.
'a' - like 'c', but only applies when the current working directory outside of CtrlP isn't a direct ancestor of the directory of the current file.
0 or '' (empty string) - disable this feature.

set wildignore+=*/tmp/*,*.so,*.swp,*.zip     " Linux/MacOSX  
set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe  " Windows  

And/Or CtrlP's own g:ctrlp_custom_ignore:

let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'  
let g:ctrlp_custom_ignore = {  
    \ 'dir':  '\v[\/]\.(git|hg|svn)$',  
    \ 'file': '\v\.(exe|so|dll)$',  
    \ 'link': 'SOME_BAD_SYMBOLIC_LINKS',  
    \ }  
let g:ctrlp_user_command = 'find %s -type f'        " MacOSX/Linux  
let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d'  " Windows  

Single VCS listing command:

let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files']  
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . -co --exclude-standard', 'find %s -type f']  
let g:ctrlp_user_command = ['.hg', 'hg --cwd %s locate -I .']  

Multiple VCS listing commands:

let g:ctrlp_user_command = {  
    \ 'types': {  
        \ 1: ['.git', 'cd %s && git ls-files'],  
        \ 2: ['.hg', 'hg --cwd %s locate -I .'],  
        \ },  
    \ 'fallback': 'find %s -type f'  
    \ }  

Check :help ctrlp-options for other options.

Get ctrlp.vim:

  1. Clone the plugin into a separate directory:
$ cd ~/.vim  
$ git clone https://github.com/kien/ctrlp.vim.git bundle/ctrlp.vim  

Or if you prefer Mercurial:

$ hg clone https://bitbucket.org/kien/ctrlp.vim bundle/ctrlp.vim  
  1. Add to your ~/.vimrc:
set runtimepath^=~/.vim/bundle/ctrlp.vim  
  1. Run at Vim's command line:
:helptags ~/.vim/bundle/ctrlp.vim/doc  
  1. Restart Vim and check :help ctrlp.txt for usage instructions and configuration details.

Direct downloads: