bgneal@7
|
1 # ctrlp.vim
|
bgneal@7
|
2 Full path fuzzy __file__, __buffer__, __mru__ and __tag__ finder for Vim.
|
bgneal@7
|
3
|
bgneal@7
|
4 * Written in pure Vimscript for MacVim and Vim 7.0+.
|
bgneal@7
|
5 * Full support for Vim’s regexp as search pattern.
|
bgneal@7
|
6 * Built-in Most Recently Used (MRU) files monitoring.
|
bgneal@7
|
7 * Built-in project’s root finder.
|
bgneal@7
|
8 * Open Multiple Files.
|
bgneal@7
|
9 * [Extensible][3].
|
bgneal@7
|
10
|
bgneal@7
|
11 ![ctrlp][1]
|
bgneal@7
|
12
|
bgneal@7
|
13 ## Basic Usage
|
bgneal@7
|
14 * Press `<c-p>` or run `:CtrlP` to invoke CtrlP in find file mode.
|
bgneal@7
|
15 * Run `:CtrlPBuffer` or `:CtrlPMRU` to invoke CtrlP in buffer or MRU mode.
|
bgneal@7
|
16 * Or run `:CtrlPMixed` to search in a mix of files, buffers and MRU files.
|
bgneal@7
|
17
|
bgneal@7
|
18 Once CtrlP is open:
|
bgneal@7
|
19
|
bgneal@7
|
20 * Press `<c-f>` and `<c-b>` to switch between find file, buffer, and MRU file
|
bgneal@7
|
21 modes.
|
bgneal@7
|
22 * Press `<c-d>` to switch to filename only search instead of full path.
|
bgneal@7
|
23 * Press `<c-r>` to switch to regexp mode.
|
bgneal@7
|
24 * Press `<F5>` to purge the cache for the current directory and get new files.
|
bgneal@7
|
25 * End the input string with a colon `:` followed by a command to execute after
|
bgneal@7
|
26 opening the file.
|
bgneal@7
|
27 e.g. `abc:45` will open the file matched the pattern and jump to line 45.
|
bgneal@7
|
28 * Submit two dots `..` as the input string to go backward the directory tree by
|
bgneal@7
|
29 1 level.
|
bgneal@7
|
30 * Use `<c-y>` to create a new file and its parent dirs.
|
bgneal@7
|
31 * Use `<c-z>` to mark/unmark multiple files and `<c-o>` to open them.
|
bgneal@7
|
32
|
bgneal@7
|
33 ## Basic Options
|
bgneal@7
|
34 * Change the mapping to invoke CtrlP:
|
bgneal@7
|
35
|
bgneal@7
|
36 ```vim
|
bgneal@7
|
37 let g:ctrlp_map = '<c-p>'
|
bgneal@7
|
38 ```
|
bgneal@7
|
39
|
bgneal@7
|
40 * When CtrlP is invoked, it automatically sets its local working directory
|
bgneal@7
|
41 according to this variable:
|
bgneal@7
|
42
|
bgneal@7
|
43 ```vim
|
bgneal@7
|
44 let g:ctrlp_working_path_mode = 2
|
bgneal@7
|
45 ```
|
bgneal@7
|
46
|
bgneal@7
|
47 0 - don’t manage working directory.
|
bgneal@7
|
48 1 - the parent directory of the current file.
|
bgneal@7
|
49 2 - the nearest ancestor that contains one of these directories or files:
|
bgneal@7
|
50 `.git/` `.hg/` `.svn/` `.bzr/` `_darcs/`
|
bgneal@7
|
51
|
bgneal@7
|
52 * If you want to exclude directories or files from the search, use the Vim’s
|
bgneal@7
|
53 option `wildignore` and/or the option `g:ctrlp_custom_ignore`. Examples:
|
bgneal@7
|
54
|
bgneal@7
|
55 ```vim
|
bgneal@7
|
56 set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
|
bgneal@7
|
57 set wildignore+=tmp\*,*.swp,*.zip,*.exe " Windows
|
bgneal@7
|
58
|
bgneal@7
|
59 let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$'
|
bgneal@7
|
60 let g:ctrlp_custom_ignore = {
|
bgneal@7
|
61 \ 'dir': '\.git$\|\.hg$\|\.svn$',
|
bgneal@7
|
62 \ 'file': '\.exe$\|\.so$\|\.dll$',
|
bgneal@7
|
63 \ 'link': 'some_bad_symbolic_links',
|
bgneal@7
|
64 \ }
|
bgneal@7
|
65 ```
|
bgneal@7
|
66
|
bgneal@7
|
67 * Use a custom file listing command with:
|
bgneal@7
|
68
|
bgneal@7
|
69 ```vim
|
bgneal@7
|
70 let g:ctrlp_user_command = 'find %s -type f' " MacOSX/Linux
|
bgneal@7
|
71 let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d' " Windows
|
bgneal@7
|
72 ```
|
bgneal@7
|
73
|
bgneal@7
|
74 _Check [the docs][2] for more mappings, commands and options._
|
bgneal@7
|
75
|
bgneal@7
|
76 [1]: http://i.imgur.com/yIynr.png
|
bgneal@7
|
77 [2]: https://github.com/kien/ctrlp.vim/blob/master/doc/ctrlp.txt
|
bgneal@7
|
78 [3]: https://github.com/kien/ctrlp.vim/tree/extensions
|