comparison vendor/vim-packs/ctrlp.vim/doc/ctrlp.txt @ 707:4576f1471f53

[update-vendor, vim] add ctrlp
author nanaya <me@nanaya.net>
date Sun, 18 Dec 2022 22:27:56 +0900
parents
children
comparison
equal deleted inserted replaced
706:4b30df382167 707:4576f1471f53
1 *ctrlp.txt* Fuzzy file, buffer, mru, tag, ... finder. v1.80
2 *CtrlP* *ControlP* *'ctrlp'* *'ctrl-p'*
3 ===============================================================================
4 # #
5 # :::::::: ::::::::::: ::::::::: ::: ::::::::: #
6 # :+: :+: :+: :+: :+: :+: :+: :+: #
7 # +:+ +:+ +:+ +:+ +:+ +:+ +:+ #
8 # +#+ +#+ +#++:++#: +#+ +#++:++#+ #
9 # +#+ +#+ +#+ +#+ +#+ +#+ #
10 # #+# #+# #+# #+# #+# #+# #+# #
11 # ######## ### ### ### ########## ### #
12 # #
13 ===============================================================================
14 CONTENTS *ctrlp-contents*
15
16 1. Intro........................................|ctrlp-intro|
17 2. Options......................................|ctrlp-options|
18 3. Commands.....................................|ctrlp-commands|
19 4. Mappings.....................................|ctrlp-mappings|
20 5. Input Formats................................|ctrlp-input-formats|
21 6. Extensions...................................|ctrlp-extensions|
22
23 ===============================================================================
24 INTRO *ctrlp-intro*
25
26 Full path fuzzy file, buffer, mru, tag, ... finder with an intuitive interface.
27 Written in pure Vimscript for MacVim, gVim and Vim version 7.0+. Has full
28 support for Vim's |regexp| as search pattern, built-in MRU files monitoring,
29 project's root finder, and more.
30
31 To enable optional extensions (tag, dir, rtscript...), see |ctrlp-extensions|.
32
33 ===============================================================================
34 OPTIONS *ctrlp-options*
35
36 Overview:~
37
38 |loaded_ctrlp|................Disable the plugin.
39 |ctrlp_map|...................Default mapping.
40 |ctrlp_cmd|...................Default command used for the default mapping.
41 |ctrlp_by_filename|...........Default to filename mode or not.
42 |ctrlp_regexp|................Default to regexp mode or not.
43 |ctrlp_match_window|..........Order, height and position of the match window.
44 |ctrlp_switch_buffer|.........Jump to an open buffer if already opened.
45 |ctrlp_reuse_window|..........Reuse special windows (help, quickfix, etc).
46 |ctrlp_tabpage_position|......Where to put the new tab page.
47 |ctrlp_working_path_mode|.....How to set CtrlP's local working directory.
48 |ctrlp_root_markers|..........Additional, high priority root markers.
49 |ctrlp_use_caching|...........Use per-session caching or not.
50 |ctrlp_clear_cache_on_exit|...Keep cache after exiting Vim or not.
51 |ctrlp_cache_dir|.............Location of the cache directory.
52 |ctrlp_show_hidden|...........Ignore dotfiles and dotdirs or not.
53 |ctrlp_custom_ignore|.........Hide stuff when using |globpath()|.
54 |ctrlp_max_files|.............Number of files to scan initially.
55 |ctrlp_max_depth|.............Directory depth to recurse into when scanning.
56 |ctrlp_user_command|..........Use an external scanner.
57 |ctrlp_max_history|...........Number of entries saved in the prompt history.
58 |ctrlp_open_new_file|.........How to open a file created by <c-y>.
59 |ctrlp_open_multiple_files|...How to open files selected by <c-z>.
60 |ctrlp_arg_map|...............Intercept <c-y> and <c-o> or not.
61 |ctrlp_follow_symlinks|.......Follow symbolic links or not.
62 |ctrlp_lazy_update|...........Only update when typing has stopped.
63 |ctrlp_default_input|.........Seed the prompt with an initial string.
64 |ctrlp_abbrev|................Input abbreviations.
65 |ctrlp_key_loop|..............Use input looping for multi-byte input.
66 |ctrlp_prompt_mappings|.......Change the mappings inside the prompt.
67 |ctrlp_line_prefix|...........Prefix for each line in ctrlp window.
68 |ctrlp_open_single_match|.....Automatically accept when only one candidate.
69 |ctrlp_brief_prompt|..........Exit CtrlP on empty prompt by <bs>.
70 |ctrlp_match_current_file|....Include current file in match entries.
71 |ctrlp_types|.................Names of builtin types.
72
73 MRU mode:
74 |ctrlp_mruf_max|..............Max MRU entries to remember.
75 |ctrlp_mruf_exclude|..........Files that shouldn't be remembered.
76 |ctrlp_mruf_include|..........Files to be remembered.
77 |ctrlp_mruf_relative|.........Show only MRU files in the working directory.
78 |ctrlp_tilde_homedir|....Save MRU file paths in home dir as ~/.
79 |ctrlp_mruf_default_order|....Disable sorting.
80 |ctrlp_mruf_case_sensitive|...MRU files are case sensitive or not.
81 |ctrlp_mruf_save_on_update|...Save to disk whenever a new entry is added.
82
83 Buffer mode:
84 |ctrlp_bufname_mod|...........File name section modificator.
85 |ctrlp_bufpath_mod|...........File path section modificator.
86
87 BufferTag mode: (to enable, see |ctrlp-extensions|)
88 |g:ctrlp_buftag_ctags_bin|....The location of the ctags-compatible binary.
89 |g:ctrlp_buftag_systemenc|....The encoding used for the ctags command.
90 |g:ctrlp_buftag_types|........Add new filetypes and set the cmd arguments.
91
92 Advanced options:
93 |ctrlp_open_func|.............Use custom file opening functions.
94 |ctrlp_status_func|...........Change CtrlP's two statuslines.
95 |ctrlp_buffer_func|...........Call custom functions in the CtrlP buffer.
96 |ctrlp_match_func|............Replace the built-in matching algorithm.
97
98 -------------------------------------------------------------------------------
99 Detailed descriptions and default values:~
100
101 *'g:ctrlp_map'*
102 Use this option to change the mapping to invoke CtrlP in |Normal| mode: >
103 let g:ctrlp_map = '<c-p>'
104 <
105
106 *'g:ctrlp_cmd'*
107 Set the default opening command to use when pressing the above mapping: >
108 let g:ctrlp_cmd = 'CtrlP'
109 <
110
111 *'g:loaded_ctrlp'*
112 Use this to disable the plugin completely: >
113 let g:loaded_ctrlp = 1
114 <
115
116 *'g:ctrlp_by_filename'*
117 Set this to 1 to set searching by filename (as opposed to full path) as the
118 default: >
119 let g:ctrlp_by_filename = 0
120 <
121 Can be toggled on/off by pressing <c-d> inside the prompt.
122
123 *'g:ctrlp_regexp'*
124 Set this to 1 to set regexp search as the default: >
125 let g:ctrlp_regexp = 0
126 <
127 Can be toggled on/off by pressing <c-r> inside the prompt.
128
129 *'g:ctrlp_match_window'*
130 Change the position, the listing order of results, the minimum and the maximum
131 heights of the match window: >
132 let g:ctrlp_match_window = ''
133 <
134 Example: >
135 let g:ctrlp_match_window = 'bottom,order:btt,min:1,max:10,results:10'
136 <
137 The position: (default: bottom)
138 top - show the match window at the top of the screen.
139 bottom - show the match window at the bottom of the screen.
140
141 The listing order of results: (default: btt)
142 order:ttb - from top to bottom.
143 order:btt - from bottom to top.
144
145 The minimum and maximum heights:
146 min:{n} - show minimum {n} lines (default: 1).
147 max:{n} - show maximum {n} lines (default: 10).
148
149 The maximum number of results:
150 results:{n} - list maximum {n} results (default: sync with max height).
151 0 mean no-limit.
152
153 Note: When a setting isn't set, its default value will be used.
154
155 *'g:ctrlp_switch_buffer'*
156 When opening a file, if it's already open in a window somewhere, CtrlP will try
157 to jump to it instead of opening a new instance: >
158 let g:ctrlp_switch_buffer = 'Et'
159 <
160 e - jump when <cr> is pressed, but only to windows in the current tab.
161 t - jump when <c-t> is pressed, but only to windows in another tab.
162 v - like "e", but jump when <c-v> is pressed.
163 h - like "e", but jump when <c-x> is pressed.
164 E, T, V, H - like "e", "t", "v", and "h", but jump to windows anywhere.
165 0 or <empty> - disable this feature.
166
167 *'g:ctrlp_reuse_window'*
168 When opening a file with <cr>, CtrlP avoids opening it in windows created by
169 plugins, help and quickfix. Use this to setup some exceptions: >
170 let g:ctrlp_reuse_window = 'netrw'
171 <
172 Acceptable values are partial name, filetype or buftype of the special buffers.
173 Use regexp to specify the pattern.
174 Example: >
175 let g:ctrlp_reuse_window = 'netrw\|help\|quickfix'
176 <
177
178 *'g:ctrlp_tabpage_position'*
179 Where to put the new tab page when opening one: >
180 let g:ctrlp_tabpage_position = 'ac'
181 <
182 a - after.
183 b - before.
184 c - the current tab page.
185 l - the last tab page.
186 f - the first tab page.
187
188 *'g:ctrlp_working_path_mode'*
189 When starting up, CtrlP sets its local working directory according to this
190 variable: >
191 let g:ctrlp_working_path_mode = 'ra'
192 <
193 c - the directory of the current file.
194 a - the directory of the current file, unless it is a subdirectory of the cwd
195 r - the nearest ancestor of the current file that contains one of these
196 directories or files:
197 .git .hg .svn .bzr _darcs
198 w - modifier to "r": start search from the cwd instead of the current file's
199 directory
200 0 or <empty> - disable this feature.
201
202 Note #1: if "a" or "c" is included with "r", use the behavior of "a" or "c" (as
203 a fallback) when a root can't be found.
204
205 Note #2: you can use a |b:var| to set this option on a per buffer basis.
206
207 *'g:ctrlp_root_markers'*
208 Use this to set your own root markers in addition to the default ones (.git,
209 .hg, .svn, .bzr, and _darcs). Your markers will take precedence: >
210 let g:ctrlp_root_markers = ['']
211 <
212 Note: you can use a |b:var| to set this option on a per buffer basis.
213
214 *'g:ctrlp_use_caching'*
215 Enable/Disable per-session caching: >
216 let g:ctrlp_use_caching = 1
217 <
218 0 - Disable caching.
219 1 - Enable caching.
220 n - When bigger than 1, disable caching and use the number as the limit to
221 enable caching again.
222
223 Note: you can quickly purge the cache by pressing <F5> while inside CtrlP.
224
225 *'g:ctrlp_clear_cache_on_exit'*
226 Set this to 0 to enable cross-session caching by not deleting the cache files
227 upon exiting Vim: >
228 let g:ctrlp_clear_cache_on_exit = 1
229 <
230
231 *'g:ctrlp_cache_dir'*
232 Set the directory to store the cache files: >
233 let g:ctrlp_cache_dir = $HOME.'/.cache/ctrlp'
234 <
235
236 *'g:ctrlp_show_hidden'*
237 Set this to 1 if you want CtrlP to scan for dotfiles and dotdirs: >
238 let g:ctrlp_show_hidden = 0
239 <
240 Note: does not apply when a command defined with |g:ctrlp_user_command| is
241 being used.
242
243 *'g:ctrlp_custom_ignore'*
244 In addition to |g:ctrlp_show_hidden|, use this for files
245 and directories you want only CtrlP to not show. Use regexp to specify the
246 patterns: >
247 let g:ctrlp_custom_ignore = ''
248 <
249 Examples: >
250 let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
251 let g:ctrlp_custom_ignore = {
252 \ 'dir': '\v[\/]\.(git|hg|svn)$',
253 \ 'file': '\v\.(exe|so|dll)$',
254 \ 'link': 'SOME_BAD_SYMBOLIC_LINKS',
255 \ }
256 let g:ctrlp_custom_ignore = {
257 \ 'file': '\v(\.cpp|\.h|\.hh|\.cxx)@<!$'
258 \ }
259 let g:ctrlp_custom_ignore = {
260 \ 'func': 'some#custom#match_function'
261 \ }
262 <
263 Note #1: |g:ctrlp_custom_ignore| does not apply when a
264 command defined with |g:ctrlp_user_command| is being used.
265
266 Note #2: when changing the option's variable type, remember to |:unlet| it
267 first or restart Vim to avoid the "E706: Variable type mismatch" error.
268
269 Note #3: when using the "func" ignore type, you must provide the full name of
270 a function that can be called from CtrlP. An |autoload| function name is
271 recommended here. The function must take 2 parameters, the item to match and
272 its type. The type will be "dir", "file", or "link". The function must return
273 1 if the item should be ignored, 0 otherwise.
274
275 Note #4: when |g:ctrlp_use_readdir| is set to 0, you can also use Vim's |'wildignore'|
276 to exclude files and directories.
277
278 *'g:ctrlp_max_files'*
279 The maximum number of files to scan, set to 0 for no limit: >
280 let g:ctrlp_max_files = 10000
281 <
282 Note: does not apply when a command defined with |g:ctrlp_user_command| is
283 being used.
284
285 *'g:ctrlp_max_depth'*
286 The maximum depth of a directory tree to recurse into: >
287 let g:ctrlp_max_depth = 40
288 <
289 Note: does not apply when a command defined with |g:ctrlp_user_command| is
290 being used.
291
292 *'g:ctrlp_user_command'*
293 Specify an external tool to use for listing files instead of using Vim's
294 |globpath()|. Use %s in place of the target directory: >
295 let g:ctrlp_user_command = ''
296 <
297 Examples: >
298 let g:ctrlp_user_command = 'find %s -type f' " MacOSX/Linux
299 let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d' " Windows
300 <
301 You can also use 'grep', 'findstr' or something else to filter the results.
302 Examples: >
303 let g:ctrlp_user_command =
304 \ 'find %s -type f | grep -v -P "\.jpg$|/tmp/"' " MacOSX/Linux
305 let g:ctrlp_user_command =
306 \ 'dir %s /-n /b /s /a-d | findstr /v /l ".jpg \\tmp\\"' " Windows
307 <
308 Use a version control listing command when inside a repository, this is faster
309 when scanning large projects: >
310 let g:ctrlp_user_command = [root_marker, listing_command, fallback_command]
311 let g:ctrlp_user_command = {
312 \ 'types': {
313 \ 1: [root_marker_1, listing_command_1],
314 \ n: [root_marker_n, listing_command_n],
315 \ },
316 \ 'fallback': fallback_command,
317 \ 'ignore': 0 or 1
318 \ }
319 <
320 Some examples: >
321 " Single VCS, listing command does not list untracked files:
322 let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files']
323 let g:ctrlp_user_command = ['.hg', 'hg --cwd %s locate -I .']
324
325 " Multiple VCS's:
326 let g:ctrlp_user_command = {
327 \ 'types': {
328 \ 1: ['.git', 'cd %s && git ls-files'],
329 \ 2: ['.hg', 'hg --cwd %s locate -I .'],
330 \ },
331 \ 'fallback': 'find %s -type f'
332 \ }
333
334 " Single VCS, listing command lists untracked files (slower):
335 let g:ctrlp_user_command =
336 \ ['.git', 'cd %s && git ls-files -co --exclude-standard']
337
338 let g:ctrlp_user_command =
339 \ ['.hg', 'hg --cwd %s status -numac -I . $(hg root)'] " MacOSX/Linux
340
341 let g:ctrlp_user_command = ['.hg', 'for /f "tokens=1" %%a in (''hg root'') '
342 \ . 'do hg --cwd %s status -numac -I . %%a'] " Windows
343 <
344 Note #1: in the |Dictionary| format, 'fallback' and 'ignore' are optional. In
345 the |List| format, fallback_command is optional.
346
347 Note #2: if the fallback_command is empty or the 'fallback' key is not defined,
348 |globpath()| will then be used when scanning outside of a repository.
349
350 Note #3: unless the |Dictionary| format is used and 'ignore' is defined and set
351 to 1, the |wildignore| and |g:ctrlp_custom_ignore| options do not apply when
352 these custom commands are being used. When not present, 'ignore' is set to 0 by
353 default to retain the performance advantage of using external commands.
354
355 Note #4: when changing the option's variable type, remember to |:unlet| it
356 first or restart Vim to avoid the "E706: Variable type mismatch" error.
357
358 Note #5: you can use a |b:var| to set this option on a per buffer basis.
359
360 *'g:ctrlp_max_history'*
361 The maximum number of input strings you want CtrlP to remember. The default
362 value mirrors Vim's global |'history'| option: >
363 let g:ctrlp_max_history = &history
364 <
365 Set to 0 to disable prompt's history. Browse the history with <c-n> and <c-p>.
366
367 *'g:ctrlp_open_new_file'*
368 Use this option to specify how the newly created file is to be opened when
369 pressing <c-y>: >
370 let g:ctrlp_open_new_file = 'v'
371 <
372 t - in a new tab.
373 h - in a new horizontal split.
374 v - in a new vertical split.
375 r - in the current window.
376
377 *'g:ctrlp_open_multiple_files'*
378 If non-zero, this will enable opening multiple files with <c-z> and <c-o>: >
379 let g:ctrlp_open_multiple_files = 'v'
380 <
381 Example: >
382 let g:ctrlp_open_multiple_files = '2vjr'
383 <
384 For the number:
385 - If given, it'll be used as the maximum number of windows or tabs to create
386 when opening the files (the rest will be opened as hidden buffers).
387 - If not given, <c-o> will open all files, each in a new window or new tab.
388
389 For the letters:
390 t - each file in a new tab.
391 h - each file in a new horizontal split.
392 v - each file in a new vertical split.
393 i - all files as hidden buffers.
394 j - after opening, jump to the first opened tab or window.
395 r - open the first file in the current window, then the remaining files in
396 new splits or new tabs depending on which of "h", "v" and "t" is also
397 present.
398
399 *'g:ctrlp_arg_map'*
400 When this is set to 1, the <c-o> and <c-y> mappings will accept one extra key
401 as an argument to override their default behavior: >
402 let g:ctrlp_arg_map = 0
403 <
404 Pressing <c-o> or <c-y> will then prompt for a keypress. The key can be:
405 t - open in tab(s)
406 h - open in horizontal split(s)
407 v - open in vertical split(s)
408 i - open as hidden buffers (for <c-o> only)
409 c - clear the marked files (for <c-o> only)
410 r - open in the current window (for <c-y> only)
411 <esc>, <c-c>, <c-u> - cancel and go back to the prompt.
412 <cr> - use the default behavior specified with |g:ctrlp_open_new_file| and
413 |g:ctrlp_open_multiple_files|.
414
415 *'g:ctrlp_follow_symlinks'*
416 If non-zero, CtrlP will follow symbolic links when listing files: >
417 let g:ctrlp_follow_symlinks = 0
418 <
419 0 - don't follow symbolic links.
420 1 - follow but ignore looped internal symlinks to avoid duplicates.
421 2 - follow all symlinks indiscriminately.
422
423 Note: does not apply when a command defined with |g:ctrlp_user_command| is
424 being used.
425
426 *'g:ctrlp_lazy_update'*
427 Set this to 1 or bigger to enable the lazy-update feature: only update the
428 match window after typing's been stopped for a certain amount of time: >
429 let g:ctrlp_lazy_update = 0
430 <
431 If is 1, update after 250ms that value as default tuned. If bigger than 1, the
432 number will be used as the delay time in milliseconds.
433
434 *'g:ctrlp_default_input'*
435 Set this to 1 to enable seeding the prompt with the current file's relative
436 path: >
437 let g:ctrlp_default_input = 0
438 <
439 Instead of 1 or 0, if the value of the option is a string, it'll be used as-is
440 as the default input: >
441 let g:ctrlp_default_input = 'anystring'
442 <
443 This option works well together with |g:ctrlp_open_single_match|
444
445
446 *'g:ctrlp_match_current_file'*
447 Includes the current file in the match entries: >
448 let g:ctrlp_match_current_file = 1
449
450 By default, the current file is excluded from the list.
451
452 Note: does not apply when |g:ctrlp_match_func| is used.
453
454 *'g:ctrlp_types'*
455 Set this to list of names to customize core types: >
456 let g:ctrlp_types = ['mru', 'fil']
457
458 By default, the types are: >
459 let g:ctrlp_types = ['fil', 'buf', 'mru'].
460
461 *'g:ctrlp_abbrev'*
462 Define input abbreviations that can be expanded (either internally or visibly)
463 in the prompt: >
464 let g:ctrlp_abbrev = {}
465 <
466 Examples: >
467 let g:ctrlp_abbrev = {
468 \ 'gmode': 'i',
469 \ 'abbrevs': [
470 \ {
471 \ 'pattern': '^cd b',
472 \ 'expanded': '@cd ~/.vim/bundle',
473 \ 'mode': 'pfrz',
474 \ },
475 \ {
476 \ 'pattern': '\(^@.\+\|\\\@<!:.\+\)\@<! ',
477 \ 'expanded': '.\{-}',
478 \ 'mode': 'pfr',
479 \ },
480 \ {
481 \ 'pattern': '\\\@<!:.\+\zs\\\@<! ',
482 \ 'expanded': '\ ',
483 \ 'mode': 'pfz',
484 \ },
485 \ ]
486 \ }
487 <
488 The 'pattern' string is regexp matched against the entered input. The expansion
489 is as if the 'expanded' string was typed into the prompt.
490
491 For 'gmode' (optional):
492 i - expand internally (default).
493 t - insert the expanded results into the prompt as you type.
494 k - insert the expanded results when a non-keyword character is typed. Only
495 applies when "t" is also present.
496
497 For 'mode' (of each entry; optional):
498 f - only in filename mode.
499 p - only in full path mode.
500 r - only in regexp mode.
501 z - only in fuzzy mode.
502 n - only when creating a new file with <c-y> (use the expanded string in the
503 new filename).
504 c - only when auto-completing directory names with <tab> (expand the pattern
505 immediately before doing the auto-completion).
506 <empty> or not defined - always enable.
507
508 Note: the abbrev entries are evaluated in sequence, so a later entry can be
509 evaluated against the expanded result of a previous entry; this includes itself
510 when 'gmode' is "t".
511
512 *'g:ctrlp_key_loop'*
513 An experimental feature. Set this to 1 to enable input looping for the typing
514 of multi-byte characters: >
515 let g:ctrlp_key_loop = 0
516 <
517 Note #1: when set, this option resets the |g:ctrlp_lazy_update| option.
518
519 Note #2: you can toggle this feature inside the prompt with a custom mapping: >
520 let g:ctrlp_prompt_mappings = { 'ToggleKeyLoop()': ['<F3>'] }
521 <
522
523 *'g:ctrlp_prompt_mappings'*
524 Use this to customize the mappings inside CtrlP's prompt to your liking. You
525 only need to keep the lines that you've changed the values (inside []): >
526 let g:ctrlp_prompt_mappings = {
527 \ 'PrtBS()': ['<bs>', '<c-]>'],
528 \ 'PrtDelete()': ['<del>'],
529 \ 'PrtDeleteWord()': ['<c-w>'],
530 \ 'PrtClear()': ['<c-u>'],
531 \ 'PrtSelectMove("j")': ['<c-j>', '<down>'],
532 \ 'PrtSelectMove("k")': ['<c-k>', '<up>'],
533 \ 'PrtSelectMove("t")': ['<Home>', '<kHome>'],
534 \ 'PrtSelectMove("b")': ['<End>', '<kEnd>'],
535 \ 'PrtSelectMove("u")': ['<PageUp>', '<kPageUp>'],
536 \ 'PrtSelectMove("d")': ['<PageDown>', '<kPageDown>'],
537 \ 'PrtHistory(-1)': ['<c-n>'],
538 \ 'PrtHistory(1)': ['<c-p>'],
539 \ 'AcceptSelection("e")': ['<cr>', '<2-LeftMouse>'],
540 \ 'AcceptSelection("h")': ['<c-x>', '<c-cr>', '<c-s>'],
541 \ 'AcceptSelection("t")': ['<c-t>'],
542 \ 'AcceptSelection("v")': ['<c-v>', '<RightMouse>'],
543 \ 'ToggleFocus()': ['<s-tab>'],
544 \ 'ToggleRegex()': ['<c-r>'],
545 \ 'ToggleByFname()': ['<c-d>'],
546 \ 'ToggleType(1)': ['<c-f>', '<c-up>'],
547 \ 'ToggleType(-1)': ['<c-b>', '<c-down>'],
548 \ 'PrtExpandDir()': ['<tab>'],
549 \ 'PrtInsert("c")': ['<MiddleMouse>', '<insert>'],
550 \ 'PrtInsert()': ['<c-\>'],
551 \ 'PrtCurStart()': ['<c-a>'],
552 \ 'PrtCurEnd()': ['<c-e>'],
553 \ 'PrtCurLeft()': ['<c-h>', '<left>', '<c-^>'],
554 \ 'PrtCurRight()': ['<c-l>', '<right>'],
555 \ 'PrtClearCache()': ['<F5>'],
556 \ 'PrtDeleteEnt()': ['<F7>'],
557 \ 'CreateNewFile()': ['<c-y>'],
558 \ 'MarkToOpen()': ['<c-z>'],
559 \ 'OpenMulti()': ['<c-o>'],
560 \ 'PrtExit()': ['<esc>', '<c-c>', '<c-g>'],
561 \ }
562 <
563 Note: if pressing <bs> moves the cursor one character to the left instead of
564 deleting a character for you, add this to your |.vimrc| to disable the plugin's
565 default <c-h> mapping: >
566 let g:ctrlp_prompt_mappings = { 'PrtCurLeft()': ['<left>', '<c-^>'] }
567 <
568
569 *'g:ctrlp_line_prefix'*
570 This prefix will be prepended to each line in ctrlp's item listing.
571 default: >
572 let g:ctrlp_line_prefix = '> '
573 <
574
575 *'g:ctrlp_open_single_match'*
576 List of CtrlP modes for which CtrlP should accept an entry directly, if only
577 one candidate exists.
578 Example: >
579 let g:ctrlp_open_single_match = ['buffer tags', 'buffer']
580 <
581 This is currently only really useful together with |g:ctrlp_default_input|
582 set before launching, and cleared afterwards, with a function such as
583 following: >
584 fu! <SID>tagsUnderCursor()
585 try
586 let default_input_save = get(g:, 'ctrlp_default_input', '')
587 let g:ctrlp_default_input = expand('<cword>')
588 CtrlPBufTagAll
589 finally
590 if exists('default_input_save')
591 let g:ctrlp_default_input = default_input_save
592 endif
593 endtry
594 endfu
595 >
596 <
597 ----------------------------------------
598 MRU mode options:~
599
600 *'g:ctrlp_mruf_max'*
601 Specify the number of recently opened files you want CtrlP to remember: >
602 let g:ctrlp_mruf_max = 250
603 <
604
605 *'g:ctrlp_mruf_exclude'*
606 Files you don't want CtrlP to remember. Use regexp to specify the patterns: >
607 let g:ctrlp_mruf_exclude = ''
608 <
609 Examples: >
610 let g:ctrlp_mruf_exclude = '/tmp/.*\|/temp/.*' " MacOSX/Linux
611 let g:ctrlp_mruf_exclude = '^C:\\dev\\tmp\\.*' " Windows
612 <
613
614 *'g:ctrlp_mruf_include'*
615 And if you want CtrlP to only remember some files, specify them here: >
616 let g:ctrlp_mruf_include = ''
617 <
618 Example: >
619 let g:ctrlp_mruf_include = '\.py$\|\.rb$'
620 <
621
622 *'g:ctrlp_tilde_homedir'*
623 Set this to 1 to save every MRU file path $HOME/$filepath in the $HOME dir
624 as ~/$filepath instead of $HOME/$filepath : >
625 let g:ctrlp_tilde_homedir = 0
626 <
627 Note: This applies also to all dir paths stored by :CtrlPBookmarkDirAdd!
628
629 *'g:ctrlp_mruf_relative'*
630 Set this to 1 to show only MRU files in the current working directory: >
631 let g:ctrlp_mruf_relative = 0
632 <
633 Note: you can use a custom mapping to toggle this option inside the prompt: >
634 let g:ctrlp_prompt_mappings = { 'ToggleMRURelative()': ['<F2>'] }
635 <
636 *'g:ctrlp_mruf_default_order'*
637 Set this to 1 to disable sorting when searching in MRU mode: >
638 let g:ctrlp_mruf_default_order = 0
639 <
640
641 *'g:ctrlp_mruf_case_sensitive'*
642 Match this with your file system case-sensitivity setting to avoid duplicate
643 MRU entries: >
644 let g:ctrlp_mruf_case_sensitive = 1
645 <
646
647 *'g:ctrlp_mruf_save_on_update'*
648 Set this to 0 to disable saving of the MRU list to hard drive whenever a new
649 entry is added, saving will then only occur when exiting Vim: >
650 let g:ctrlp_mruf_save_on_update = 1
651 <
652 *'g:ctrlp_bufname_mod'*
653 Modify file name section according to modificator string. See |filename-modifiers|. >
654 let g:ctrlp_bufname_mod = ':t'
655 <
656 *'g:ctrlp_bufpath_mod'*
657 Modify file path section according to modificator string. See |filename-modifiers|. >
658 let g:ctrlp_bufpath_mod = ':~:.:h'
659 <
660 ----------------------------------------
661 Advanced options:~
662
663 *'g:ctrlp_open_func'*
664 Define a custom function to open the selected file: >
665 let g:ctrlp_open_func = {}
666 <
667 Example: >
668 let g:ctrlp_open_func = {
669 \ 'files' : 'Function_Name_1',
670 \ 'buffers' : 'Function_Name_2',
671 \ 'mru files' : 'Function_Name_3',
672 \ }
673 <
674 Structure of the functions: >
675 function! Function_Name(action, line)
676 " Arguments:
677 " |
678 " +- a:action : The opening action:
679 " | + 'e' : user pressed <cr> (default)
680 " | + 'h' : user pressed <c-x> (default)
681 " | + 'v' : user pressed <c-v> (default)
682 " | + 't' : user pressed <c-t> (default)
683 " | + 'x' : user used the <c-o> console dialog (default) and
684 " | chose "e[x]ternal".
685 " |
686 " +- a:line : The selected line.
687
688 endfunction
689 <
690 Note: does not apply when opening multiple files with <c-z> and <c-o>.
691
692 Example: open HTML files in the default web browser when <c-t> is pressed and
693 in Vim otherwise >
694 function! HTMLOpenFunc(action, line)
695 if a:action =~ '^[tx]$' && fnamemodify(a:line, ':e') =~? '^html\?$'
696
697 " Get the filename
698 let filename = fnameescape(fnamemodify(a:line, ':p'))
699
700 " Close CtrlP
701 call ctrlp#exit()
702
703 " Open the file
704 silent! execute '!xdg-open' filename
705
706 elseif a:action == 'x' && fnamemodify(a:line, ':e') !~? '^html\?$'
707
708 " Not a HTML file, simulate pressing <c-o> again and wait for new input
709 call feedkeys("\<c-o>")
710
711 else
712
713 " Use CtrlP's default file opening function
714 call call('ctrlp#acceptfile', [a:action, a:line])
715
716 endif
717 endfunction
718
719 let g:ctrlp_open_func = { 'files': 'HTMLOpenFunc' }
720 <
721
722 *'g:ctrlp_status_func'*
723 Use this to customize the statuslines for the CtrlP window: >
724 let g:ctrlp_status_func = {}
725 <
726 Example: >
727 let g:ctrlp_status_func = {
728 \ 'main': 'Function_Name_1',
729 \ 'prog': 'Function_Name_2',
730 \ }
731 <
732 Structure of the functions: >
733 " Main statusline
734 function! Function_Name_1(focus, byfname, regex, prev, item, next, marked)
735 " Arguments:
736 " |
737 " +- a:focus : The focus of the prompt: "prt" or "win".
738 " |
739 " +- a:byfname : In filename mode or in full path mode: "file" or "path".
740 " |
741 " +- a:regex : In regex mode: 1 or 0.
742 " |
743 " +- a:prev : The previous search mode.
744 " |
745 " +- a:item : The current search mode.
746 " |
747 " +- a:next : The next search mode.
748 " |
749 " +- a:marked : The number of marked files, or a comma separated list of
750 " the marked filenames.
751
752 return full_statusline
753 endfunction
754
755 " Progress statusline
756 function! Function_Name_2(str)
757 " a:str : Either the number of files scanned so far, or a string indicating
758 " the current directory is being scanned with a user_command.
759
760 return full_statusline
761 endfunction
762 <
763 See https://gist.github.com/1610859 for a working example.
764
765 *'g:ctrlp_buffer_func'*
766 Specify the functions that will be called after entering and before exiting the
767 CtrlP buffer: >
768 let g:ctrlp_buffer_func = {}
769 <
770 Example: >
771 let g:ctrlp_buffer_func = {
772 \ 'enter': 'Function_Name_1',
773 \ 'exit': 'Function_Name_2',
774 \ }
775 <
776
777 *'g:ctrlp_match_func'*
778 Set an external fuzzy matching function for CtrlP to use: >
779 let g:ctrlp_match_func = {}
780 <
781 Example: >
782 let g:ctrlp_match_func = { 'match': 'Function_Name' }
783 <
784 Structure of the function: >
785 function! Function_Name(items, str, limit, mmode, ispath, crfile, regex)
786 " Arguments:
787 " |
788 " +- a:items : The full list of items to search in.
789 " |
790 " +- a:str : The string entered by the user.
791 " |
792 " +- a:limit : The max height of the match window. Can be used to limit
793 " | the number of items to return.
794 " |
795 " +- a:mmode : The match mode. Can be one of these strings:
796 " | + "full-line": match the entire line.
797 " | + "filename-only": match only the filename.
798 " | + "first-non-tab": match until the first tab char.
799 " | + "until-last-tab": match until the last tab char.
800 " |
801 " +- a:ispath : Is 1 when searching in file, buffer, mru, mixed, dir, and
802 " | rtscript modes. Is 0 otherwise.
803 " |
804 " +- a:crfile : The file in the current window. Should be excluded from the
805 " | results when a:ispath == 1.
806 " |
807 " +- a:regex : In regex mode: 1 or 0.
808
809 return list_of_matched_items
810 endfunction
811 <
812
813 Note: you can extend any of the above options with { 'arg_type': 'dict' } to
814 enable passing all the function arguments in a single Dictionary argument. Use
815 the existing argument names as keys in this Dictionary.
816
817 Example: >
818 let g:ctrlp_status_func = {
819 \ 'arg_type' : 'dict',
820 \ 'enter': 'Function_Name_1',
821 \ 'exit': 'Function_Name_2',
822 \ }
823
824 function! Function_Name_1(dict)
825 " where dict == {
826 " \ 'focus': value,
827 " \ 'byfname': value,
828 " \ 'regex': value,
829 " \ ...
830 " }
831 endfunction
832 <
833 *'g:ctrlp_brief_prompt'*
834 When this is set to 1, the <bs> on empty prompt exit CtrlP.
835
836 *'g:ctrlp_use_readdir'*
837 Unlike kien/ctrlp.vim, ctrlpvim/ctrlp.vim uses readdir() instead of globpath()
838 for speed. Set this option to 0 if you want to revert to the original
839 behavior.
840 Example: >
841 let g:ctrlp_use_readdir = 0
842 <
843 *ctrlp-default-value*
844 Otherwise, you can use below to change default value.
845 Example: >
846 let g:ctrlp_path_nolim = 1
847
848 This is possible to change no-limit mode for match type "path".
849
850 *ctrlp_compare_lim*
851 If your search directory has more number of files than this limit, no sorting
852 will be performed for the first readout. You can improve CtrlP performance by
853 setting this to a proper value, but no sorting on the first readout can reduce
854 the quality of fuzzy finding results.
855 Example:
856 let g:ctrlp_compare_lim = 100
857
858 Set the value to 0 for unlimited sorting. Default is 0.
859
860
861 ===============================================================================
862 COMMANDS *ctrlp-commands*
863
864 *:CtrlP*
865 :CtrlP [starting-directory]
866 Open CtrlP in find file mode.
867
868 If no argument is given, the value of |g:ctrlp_working_path_mode| will be
869 used to determine the starting directory. See |:CtrlPCurFile| and
870 |:CtrlPCurWD| to temporarily override the setting.
871
872 You can use <tab> to auto-complete the [starting-directory] when typing it.
873
874 *:CtrlPBuffer*
875 :CtrlPBuffer
876 Open CtrlP in find buffer mode.
877
878 *:CtrlPCurFile*
879 :CtrlPCurFile
880 This acts like |:CtrlP| with |g:ctrlp_working_path_mode| = 'c' and ignores
881 the variable's current value.
882
883 *:CtrlPCurWD*
884 :CtrlPCurWD
885 This acts like |:CtrlP| with |g:ctrlp_working_path_mode| = 'd' and ignores
886 the variable's current value.
887
888 *:CtrlPMRU*
889 :CtrlPMRU
890 Open CtrlP in find Most-Recently-Used file mode.
891
892 *:CtrlPLastMode*
893 :CtrlPLastMode [--dir]
894 Open CtrlP in the last mode used. When having the "--dir" argument, also
895 reuse the last working directory.
896
897 *:CtrlPRoot*
898 :CtrlPRoot
899 This acts like |:CtrlP| with |g:ctrlp_working_path_mode| = 'r' and ignores
900 the variable's current value.
901
902 *:CtrlPClearCache*
903 :CtrlPClearCache
904 Flush the cache for the current working directory. The same as pressing <F5>
905 inside CtrlP.
906 To enable or disable caching, use the |g:ctrlp_use_caching| option.
907
908 *:CtrlPClearAllCaches*
909 :CtrlPClearAllCaches
910 Delete all the cache files saved in |g:ctrlp_cache_dir| location.
911
912 -------------------------------------------------------------------------------
913 For commands provided by bundled extensions, see |ctrlp-extensions|.
914
915 ===============================================================================
916 MAPPINGS *ctrlp-mappings*
917
918 *'ctrlp-<c-p>'*
919 <c-p>
920 Default |Normal| mode mapping to open the CtrlP prompt in find file mode.
921
922 ----------------------------------------
923 Once inside the prompt:~
924
925 <c-d>
926 Toggle between full-path search and filename only search.
927 Note: in filename mode, the prompt's base is '>d>' instead of '>>>'
928
929 <c-r> *'ctrlp-fullregexp'*
930 Toggle between the string mode and full regexp mode.
931 Note: in full regexp mode, the prompt's base is 'r>>' instead of '>>>'
932
933 See also: |input-formats| (guide) and |g:ctrlp_regexp_search| (option).
934
935 <c-f>, 'forward'
936 <c-up>
937 Scroll to the 'next' search mode in the sequence.
938
939 <c-b>, 'backward'
940 <c-down>
941 Scroll to the 'previous' search mode in the sequence.
942
943 <tab> *'ctrlp-autocompletion'*
944 Auto-complete directory names under the current working directory inside
945 the prompt.
946
947 <s-tab>
948 Toggle the focus between the match window and the prompt.
949
950 <esc>,
951 <c-c>,
952 <c-g>
953 Exit CtrlP.
954
955 Moving:~
956
957 <c-j>,
958 <down>
959 Move selection down.
960
961 <c-k>,
962 <up>
963 Move selection up.
964
965 <c-a>
966 Move the cursor to the 'start' of the prompt.
967
968 <c-e>
969 Move the cursor to the 'end' of the prompt.
970
971 <c-h>,
972 <left>,
973 <c-^>
974 Move the cursor one character to the 'left'.
975
976 <c-l>,
977 <right>
978 Move the cursor one character to the 'right'.
979
980 Editing:~
981
982 <c-]>,
983 <bs>
984 Delete the preceding character.
985
986 <del>
987 Delete the current character.
988
989 <c-w>
990 Delete a preceding inner word.
991
992 <c-u>
993 Clear the input field.
994
995 Browsing input history:~
996
997 <c-n>
998 Next string in the prompt's history.
999
1000 <c-p>
1001 Previous string in the prompt's history.
1002
1003 Opening/Creating a file:~
1004
1005 <cr>
1006 Open the selected file in the 'current' window if possible.
1007
1008 <c-t>
1009 Open the selected file in a new 'tab'.
1010
1011 <c-v>
1012 Open the selected file in a 'vertical' split.
1013
1014 <c-x>,
1015 <c-cr>,
1016 <c-s>
1017 Open the selected file in a 'horizontal' split.
1018
1019 <c-y>
1020 Create a new file and its parent directories.
1021
1022 Opening multiple files:~
1023
1024 <c-z>
1025 - Mark/unmark a file to be opened with <c-o>.
1026 - Mark/unmark a file to create a new file in its directory using <c-y>.
1027
1028 <c-o>
1029 - Open files marked by <c-z>.
1030 - When no file has been marked by <c-z>, open a console dialog with the
1031 following options:
1032
1033 Open the selected file:
1034 t - in a tab page.
1035 v - in a vertical split.
1036 h - in a horizontal split.
1037 r - in the current window.
1038 i - as a hidden buffer.
1039 x - (optional) with the function defined in |g:ctrlp_open_func|.
1040
1041 Other options (not shown):
1042 a - mark all files in the match window.
1043 d - change CtrlP's local working directory to the selected file's
1044 directory and switch to find file mode.
1045
1046 Function keys:~
1047
1048 <F5>
1049 - Refresh the match window and purge the cache for the current directory.
1050 - Remove deleted files from the MRU list.
1051
1052 <F7>
1053 MRU mode:
1054 - Wipe the list.
1055 - Delete entries marked by <c-z>.
1056 Buffer mode:
1057 - Delete entry under the cursor or delete multiple entries marked by <c-z>.
1058
1059
1060 Pasting:~
1061
1062 <Insert>, *'ctrlp-pasting'*
1063 <MiddleMouse>
1064 Paste the clipboard content into the prompt.
1065
1066 <c-\>
1067 Open a console dialog to paste <cword>, <cfile>, the content of the search
1068 register, the last visual selection, the clipboard or any register into the
1069 prompt.
1070
1071 Choose your own mappings with |g:ctrlp_prompt_mappings|.
1072
1073 ----------------------------------------
1074 When inside the match window (press <s-tab> to switch):~
1075
1076 a-z
1077 0-9
1078 ~^-=;`',.+!@#$%&_(){}[]
1079 Cycle through the lines which have the matching first character.
1080
1081 ===============================================================================
1082 INPUT FORMATS *ctrlp-input-formats*
1083
1084 Formats for inputting in the prompt:~
1085
1086 a) Simple string.
1087
1088 E.g. 'abc' is understood internally as 'a[^a]\{-}b[^b]\{-}c'
1089
1090 b) When in regexp mode, the input string's treated as a Vim's regexp |pattern|
1091 without any modification.
1092
1093 E.g. 'abc\d*efg' will be read as 'abc\d*efg'.
1094
1095 See |ctrlp-fullregexp| (keymap) and |g:ctrlp_regexp_search| (option) for
1096 how to enable regexp mode.
1097
1098 c) End the string with a colon ':' followed by a Vim command to execute that
1099 command after opening the file. If you need to use ':' literally, escape it
1100 with a backslash: '\:'. When opening multiple files, the command will be
1101 executed on each opening file.
1102
1103 E.g. Use ':45' to jump to line 45.
1104
1105 Use ':/any\:string' to jump to the first instance of 'any:string'.
1106
1107 Use ':+setf\ myfiletype|50' to set the filetype to 'myfiletype', then
1108 jump to line 50.
1109
1110 Use ':diffthis' when opening multiple files to run |:diffthis| on the
1111 first 4 files.
1112
1113 See also: Vim's |++opt| and |+cmd|.
1114
1115 d) Input two dots '..' and then hit the <Enter> key to go upward the directory tree by 1 level. To go up
1116 multiple levels, use one extra dot for each extra level:
1117 >
1118 Raw input Interpreted as
1119 ..<Cr> ../
1120 ...<Cr> ../../
1121 ....<Cr> ../../../
1122 <
1123 Note: if the parent directories are large and uncached, this can be slow.
1124
1125 You can also use '@cd path/' to change CtrlP's local working directory.
1126 Use '@cd %:h' to change to the directory of the current file.
1127
1128 e) Similarly, submit '/' or '\' to find and go to the project's root.
1129
1130 If the project is large, using a VCS listing command to look for files
1131 might help speeding up the initial scan (see |g:ctrlp_user_command| for more
1132 details).
1133
1134 Note: d) and e) only work in file, directory and mixed modes.
1135
1136 f) Type the name of a non-existent file and press <c-y> to create it. Mark a
1137 file with <c-z> to create the new file in the same directory as the marked
1138 file.
1139
1140 E.g. Using 'newdir/newfile.txt' will create a directory named 'newdir' as
1141 well as a file named 'newfile.txt'.
1142
1143 If an entry 'some/old/dirs/oldfile.txt' is marked with <c-z>, then
1144 'newdir' and 'newfile.txt' will be created under 'some/old/dirs'. The
1145 final path will then be 'some/old/dirs/newdir/newfile.txt'.
1146
1147 Note: use '\' in place of '/' on Windows (if |'shellslash'| is not set).
1148
1149 g) In filename mode (toggle with <c-d>), you can use one primary pattern and
1150 one refining pattern separated by a semicolon. Both patterns work like (a),
1151 or (b) when in regexp mode.
1152
1153 h) Submit ? to open this help file.
1154
1155 ===============================================================================
1156 EXTENSIONS *ctrlp-extensions*
1157
1158 Extensions are optional. To enable an extension, add its name to the variable
1159 g:ctrlp_extensions: >
1160 let g:ctrlp_extensions = ['tag', 'buffertag', 'quickfix', 'dir', 'rtscript',
1161 \ 'undo', 'line', 'changes', 'mixed', 'bookmarkdir']
1162 <
1163 The order of the items will be the order they appear on the statusline and when
1164 using <c-f>, <c-b>.
1165
1166 Available extensions:~
1167
1168 *:CtrlPTag*
1169 * Tag mode:~
1170 - Name: 'tag'
1171 - Command: ":CtrlPTag"
1172 - Search for a tag within a generated central tags file, and jump to the
1173 definition. Use the Vim's option |'tags'| to specify the names and the
1174 locations of the tags file(s).
1175 E.g. set tags+=doc/tags
1176
1177 *:CtrlPBufTag*
1178 *:CtrlPBufTagAll*
1179 * Buffer Tag mode:~
1180 - Name: 'buffertag'
1181 - Commands: ":CtrlPBufTag [buffer]",
1182 ":CtrlPBufTagAll".
1183 - Search for a tag within the current buffer or all listed buffers and jump
1184 to the definition. Requires |exuberant_ctags| or compatible programs.
1185
1186 *:CtrlPQuickfix*
1187 * Quickfix mode:~
1188 - Name: 'quickfix'
1189 - Command: ":CtrlPQuickfix"
1190 - Search for an entry in the current quickfix errors and jump to it.
1191
1192 *:CtrlPDir*
1193 * Directory mode:~
1194 - Name: 'dir'
1195 - Command: ":CtrlPDir [starting-directory]"
1196 - Search for a directory and change the working directory to it.
1197 - Mappings:
1198 + <cr> change the local working directory for CtrlP and keep it open.
1199 + <c-t> change the global working directory (exit).
1200 + <c-v> change the local working directory for the current window (exit).
1201 + <c-x> change the global working directory to CtrlP's current local
1202 working directory (exit).
1203
1204 *:CtrlPRTS*
1205 * Runtime script mode:~
1206 - Name: 'rtscript'
1207 - Command: ":CtrlPRTS"
1208 - Search for files (vimscripts, docs, snippets...) in runtimepath.
1209
1210 *:CtrlPUndo*
1211 * Undo mode:~
1212 - Name: 'undo'
1213 - Command: ":CtrlPUndo"
1214 - Browse undo history.
1215
1216 *:CtrlPLine*
1217 * Line mode:~
1218 - Name: 'line'
1219 - Command: ":CtrlPLine [buffer]"
1220 - Search for a line in all listed buffers or in the specified [buffer].
1221
1222 *:CtrlPChange*
1223 *:CtrlPChangeAll*
1224 * Change list mode:~
1225 - Name: 'changes'
1226 - Commands: ":CtrlPChange [buffer]",
1227 ":CtrlPChangeAll".
1228 - Search for and jump to a recent change in the current buffer or in all
1229 listed buffers.
1230
1231 *:CtrlPMixed*
1232 * Mixed mode:~
1233 - Name: 'mixed'
1234 - Command: ":CtrlPMixed"
1235 - Search in files, buffers and MRU files at the same time.
1236
1237 *:CtrlPBookmarkDir*
1238 *:CtrlPBookmarkDirAdd*
1239 * BookmarkDir mode:~
1240 - Name: 'bookmarkdir'
1241 - Commands: ":CtrlPBookmarkDir",
1242 ":CtrlPBookmarkDirAdd [directory] [TITLE]".
1243 ":CtrlPBookmarkDirAdd! [directory] [TITLE]".
1244
1245 - Search for a bookmarked directory and change the working directory to it.
1246 - Add either the dir [directory], if supplied, or otherwise ask for it,
1247 under the title given by either [TITLE], if supplied, or otherwise ask for
1248 it, to the CtrlPBookmarkDir list.
1249 - Add either the dir [directory], if supplied, or otherwise the current
1250 work dir ( [CWD] ) under the title given by either [TITLE], if supplied,
1251 or otherwise [CWD] to the CtrlPBookmarkDir list.
1252
1253 The last command can be used to add all recently used work dirs to the
1254 CtrlPBookmarkDir list by an autocommand like
1255
1256 >
1257 augroup CtrlPDirMRU
1258 autocmd!
1259 autocmd FileType * if &modifiable | execute 'silent CtrlPBookmarkDirAdd! %:p:h' | endif
1260 augroup END
1261 <
1262
1263 - Mappings:
1264 + <cr> change the local working directory for CtrlP, keep it open and
1265 switch to find file mode.
1266 + <c-x> change the global working directory (exit).
1267 + <c-v> change the local working directory for the current window (exit).
1268 + <F7>
1269 - Wipe bookmark list.
1270 - Delete entries marked by <c-z>.
1271
1272 *ctrlp-autoignore-extension*
1273 * Autoignore mode:~
1274 - Name: 'autoignore'
1275
1276 - This extension doesn't add new commands. It adds support for per-project
1277 ignore patterns (as per |ctrlp_custom_ignore|) via a `.ctrlpignore` file
1278 at the root of the project. It's basically like a `.gitignore` or
1279 `.hgignore` for CtrlP.
1280
1281 Note: auto-ignore won't work when |g:ctrlp_user_command| is used.
1282
1283 Note: `.ctrlpignore` will be added to the root markers (see
1284 |g:ctrlp_root_markers|).
1285
1286 - Ignore file syntax:
1287 Empty lines, and lines starting with `#` (comments) are ignored.
1288
1289 Other lines are treated like regular expression patterns. See *string-match*
1290 for how patterns are used. Anything that matches any of the patterns will be
1291 ignored from CtrlP's search results.
1292
1293 Example:
1294
1295 \.tmp$
1296 ^generated/
1297 local\.cfg
1298
1299 Note: patterns should use forward slashes, even on Windows.
1300
1301 You can also switch to a glob-like syntax like this:
1302
1303 syntax:wildignore
1304 *.tar.gz
1305 *.tmp
1306
1307 This will temporarily add each pattern to |'wildignore'| for the
1308 duration of the file scan, and remove them at the end.
1309
1310 You can switch back to the default regular-expression-based patterns by
1311 writing:
1312
1313 syntax:regexp
1314
1315 You can also specify a match on only a given type of item:
1316
1317 dir:build
1318 file:foo\.txt
1319
1320 This will only ignore directories with "build" in them, and files with
1321 "foo.txt" in them. Not files with "build" in them or vice-versa.
1322
1323 Note: to ignore a root directory "build", and not _any_ directory with
1324 "build" in it, you can root the regex: ^build$
1325
1326 - FAQ:
1327 Q: Why can't CtrlP support `.gitignore` or `.hgignore` natively?
1328
1329 A: Those files look at first like they may contain all the patterns
1330 you'd want to exclude from CtrlP already. However, more often than not,
1331 there are some differences. Those files list patterns that should not be
1332 included in source-control. This includes things you want to ignore, but
1333 also things you may not want to: local settings, external packages and
1334 dependencies, etc. The author felt the trouble of supporting various
1335 syntaxes was too much compared to just copy/pasting a few lines. Feel
1336 free to contribute a patch if you disagree :)
1337
1338 Q: I enabled |ctrlp-autoignore-extension|, or edited `.ctrlpignore`, but
1339 none of the new patterns are working. What did I do wrong?
1340
1341 A: Probably nothing! CtrlP can cache search results for faster response
1342 times. You can hit <F5> to force it to refresh. This will use the newer
1343 ignore patterns if the `.ctrlpignore` file has changed, too.
1344
1345
1346 ----------------------------------------
1347 Buffer Tag mode options:~
1348
1349 *'g:ctrlp_buftag_ctags_bin'*
1350 If ctags isn't in your $PATH, or a ctags binary exists in either
1351 /opt/local/bin or /usr/local/bin, use this to set its location: >
1352 let g:ctrlp_buftag_ctags_bin = ''
1353 <
1354
1355 *'g:ctrlp_buftag_systemenc'*
1356 Match this with your OS's encoding (not Vim's). The default value mirrors Vim's
1357 global |'encoding'| option: >
1358 let g:ctrlp_buftag_systemenc = &encoding
1359 <
1360
1361 *'g:ctrlp_buftag_types'*
1362 Use this to set the arguments for ctags, jsctags... for a given filetype: >
1363 let g:ctrlp_buftag_types = ''
1364 <
1365 Examples: >
1366 let g:ctrlp_buftag_types = {
1367 \ 'erlang' : '--language-force=erlang --erlang-types=drmf',
1368 \ 'javascript' : {
1369 \ 'bin': 'jsctags',
1370 \ 'args': '-f -',
1371 \ },
1372 \ }
1373 <
1374
1375 ===============================================================================
1376 CUSTOMIZATION *ctrlp-customization*
1377
1378 Highlighting:~
1379 * For the CtrlP buffer:
1380 CtrlPNoEntries : the message when no match is found (Error)
1381 CtrlPMatch : the matched pattern (Identifier)
1382 CtrlPLinePre : the line prefix '>' in the match window
1383 CtrlPPrtBase : the prompt's base (Comment)
1384 CtrlPPrtText : the prompt's text (|hl-Normal|)
1385 CtrlPPrtCursor : the prompt's cursor when moving over the text (Constant)
1386
1387 * Buffer explorer mode:
1388 CtrlPBufferNr : buffer number
1389 CtrlPBufferInd : '+', '-', '=' and '#' indicators (see |:buffers|)
1390 CtrlPBufferHid : hidden buffer
1391 CtrlPBufferHidMod : hidden and modified buffer
1392 CtrlPBufferVis : visible buffer
1393 CtrlPBufferVisMod : visible and modified buffer
1394 CtrlPBufferCur : current buffer
1395 CtrlPBufferCurMod : current and modified buffer
1396 CtrlPBufferPath : buffer path
1397
1398 * In extensions:
1399 CtrlPTabExtra : the part of each line that's not matched against (Comment)
1400 CtrlPBufName : the buffer name an entry belongs to (|hl-Directory|)
1401 CtrlPTagKind : the kind of the tag in buffer-tag mode (|hl-Title|)
1402 CtrlPqfLineCol : the line and column numbers in quickfix mode (Comment)
1403 CtrlPUndoT : the elapsed time in undo mode (|hl-Directory|)
1404 CtrlPUndoBr : the square brackets [] in undo mode (Comment)
1405 CtrlPUndoNr : the undo number inside [] in undo mode (String)
1406 CtrlPUndoSv : the point where the file was saved (Comment)
1407 CtrlPUndoPo : the current position in the undo tree (|hl-Title|)
1408 CtrlPBookmark : the name of the bookmark (Identifier)
1409
1410 Statuslines:~
1411 * Highlight groups:
1412 CtrlPMode1 : 'file' or 'path' or 'line', and the current mode (Character)
1413 CtrlPMode2 : 'prt' or 'win', 'regex', the working directory (|hl-LineNr|)
1414 CtrlPStats : the scanning status (Function)
1415
1416 For rebuilding the statuslines, see |g:ctrlp_status_func|.
1417
1418 ===============================================================================
1419 MISCELLANEOUS CONFIGS *ctrlp-miscellaneous-configs*
1420
1421 * Using |wildignore| for |g:ctrlp_user_command|:
1422 >
1423 function! s:wig2cmd()
1424 " Change wildignore into space or | separated groups
1425 " e.g. .aux .out .toc .jpg .bmp .gif
1426 " or .aux$\|.out$\|.toc$\|.jpg$\|.bmp$\|.gif$
1427 let pats = ['[*\/]*\([?_.0-9A-Za-z]\+\)\([*\/]*\)\(\\\@<!,\|$\)','\\\@<!,']
1428 let subs = has('win32') || has('win64') ? ['\1\3', ' '] : ['\1\2\3', '\\|']
1429 let expr = substitute(&wig, pats[0], subs[0], 'g')
1430 let expr = substitute(expr, pats[1], subs[1], 'g')
1431 let expr = substitute(expr, '\\,', ',', 'g')
1432
1433 " Set the user_command option
1434 let g:ctrlp_user_command = has('win32') || has('win64')
1435 \ ? 'dir %s /-n /b /s /a-d | findstr /V /l "'.expr.'"'
1436 \ : 'find %s -type f | grep -v "'.expr .'"'
1437 endfunction
1438
1439 call s:wig2cmd()
1440 <
1441 (submitted by Rich Alesi <github.com/ralesi>)
1442
1443 * A standalone function to set the working directory to the project's root, or
1444 to the parent directory of the current file if a root can't be found:
1445 >
1446 function! s:setcwd()
1447 let cph = expand('%:p:h', 1)
1448 if cph =~ '^.\+://' | retu | en
1449 for mkr in ['.git/', '.hg/', '.svn/', '.bzr/', '_darcs/', '.vimprojects']
1450 let wd = call('find'.(mkr =~ '/$' ? 'dir' : 'file'), [mkr, cph.';'])
1451 if wd != '' | let &acd = 0 | brea | en
1452 endfo
1453 exe 'lc!' fnameescape(wd == '' ? cph : substitute(wd, mkr.'$', '.', ''))
1454 endfunction
1455
1456 autocmd BufEnter * call s:setcwd()
1457 <
1458 (requires Vim 7.1.299+)
1459
1460 * Using a |count| to invoke different commands using the same mapping:
1461 >
1462 let g:ctrlp_cmd = 'exe "CtrlP".get(["", "Buffer", "MRU"], v:count)'
1463 <
1464
1465 ===============================================================================
1466 CREDITS *ctrlp-credits*
1467
1468 Originally developed by Kien Nguyen <github.com/kien>. Now maintained by the
1469 members of the ctrlpvim Github organisation
1470 (https://github.com/orgs/ctrlpvim/people). Distributed under Vim's |license|.
1471
1472 Project's homepage: http://ctrlpvim.github.com/ctrlp.vim
1473 Git repository: https://github.com/ctrlpvim/ctrlp.vim
1474
1475 -------------------------------------------------------------------------------
1476 Thanks to everyone that has submitted ideas, bug reports or helped debugging on
1477 gibhub, bitbucket, and through email.
1478
1479 Special thanks:~
1480
1481 * Woojong Koh <github.com/wjkoh>
1482 * Simon Ruderich
1483 * Yasuhiro Matsumoto <github.com/mattn>
1484 * Ken Earley <github.com/kenearley>
1485 * Kyo Nagashima <github.com/hail2u>
1486 * Zak Johnson <github.com/zakj>
1487 * Diego Viola <github.com/diegoviola>
1488 * Piet Delport <github.com/pjdelport>
1489 * Thibault Duplessis <github.com/ornicar>
1490 * Kent Sibilev <github.com/datanoise>
1491 * Tacahiroy <github.com/tacahiroy>
1492 * Luca Pette <github.com/lucapette>
1493 * Seth Fowler <github.com/sfowler>
1494 * Lowe Thiderman <github.com/thiderman>
1495 * Christopher Fredén <github.com/icetan>
1496 * Zahary Karadjov <github.com/zah>
1497 * Jo De Boeck <github.com/grimpy>
1498 * Rudi Grinberg <github.com/rgrinberg>
1499 * Timothy Mellor <github.com/mellort>
1500 * Sergey Vlasov <github.com/noscript>
1501
1502 ===============================================================================
1503 CHANGELOG *ctrlp-changelog*
1504
1505 * New option |g:ctrlp_custom_tag_files| to specify custom tag files.
1506 * Accept 0 for g:ctrlp_match_window no-limited window size.
1507
1508 Before 2016/11/28~
1509
1510 + New command: |YankLine()| to yank current line.
1511 + New option: |g:ctrlp_types| to select builtin modes.
1512 + New feature: asynchronized spawn of |g:ctrlp_user_command|. This enable
1513 with set |g:ctrlp_user_command_async| to 1.
1514 + Support buffertag for delphi, rust and golang.
1515 + New option: |g:ctrlp_brief_prompt|,
1516 |g:match_current_file|,
1517 |g:ctrlp_compare_lim|.
1518 + New feature: Auto-ignore extension.
1519 + Support buffertag for ant, tex, dosbatch, matlab and vhdl.
1520 + New option |g:ctrlp_line_prefix| for integrating third party plugins.
1521 + New option |g:open_single_match| to open single file in matches.
1522 + Add <plug>(ctrlp) for launch CtrlP.
1523 + Accept bang for CtrlPBookmarkDirAdd to avoid confirm.
1524 + Handle variable like "g:ctrlp_TYPE_MODE".
1525 ex: let g:ctrlp_path_sort
1526 + New option: |g:ctrlp_custom_ancestors|
1527
1528 Before 2014/08/08~
1529
1530 + New buffer explorer mode with highlighting (|+conceal| recommended)
1531 + New options: |g:ctrlp_bufname_mod|,
1532 |g:ctrlp_bufpath_mod|
1533 + Combine *g:ctrlp_match_window_bottom* *g:ctrlp_match_window_reversed* and
1534 *g:ctrlp_max_height* into |g:ctrlp_match_window|.
1535 + New option: |g:ctrlp_match_window|.
1536
1537 Before 2012/11/30~
1538
1539 + New options: |g:ctrlp_abbrev|,
1540 |g:ctrlp_key_loop|,
1541 |g:ctrlp_open_func|,
1542 |g:ctrlp_tabpage_position|,
1543 |g:ctrlp_mruf_save_on_update|
1544 + Rename:
1545 *g:ctrlp_dotfiles* -> |g:ctrlp_show_hidden|.
1546 + Change |g:ctrlp_switch_buffer|'s and |g:ctrlp_working_path_mode|'s type
1547 (old values still work).
1548 + New key for |g:ctrlp_user_command| when it's a Dictionary: 'ignore'.
1549
1550 Before 2012/06/15~
1551
1552 + New value for |g:ctrlp_follow_symlinks|: 2.
1553 + New value for |g:ctrlp_open_multiple_files|: 'j'.
1554 + Allow using <c-t>, <c-x>, <c-v> to open files marked by <c-z>.
1555 + Extend '..' (|ctrlp-input-formats| (d))
1556 + New input format: '@cd' (|ctrlp-input-formats| (d))
1557
1558 Before 2012/04/30~
1559
1560 + New option: |g:ctrlp_mruf_default_order|
1561 + New feature: Bookmarked directories extension.
1562 + New commands: |:CtrlPBookmarkDir|
1563 |:CtrlPBookmarkDirAdd|
1564
1565 Before 2012/04/15~
1566
1567 + New option: |g:ctrlp_buffer_func|, callback functions for CtrlP buffer.
1568 + Remove: g:ctrlp_mruf_last_entered, make it a default for MRU mode.
1569 + New commands: |:CtrlPLastMode|, open CtrlP in the last mode used.
1570 |:CtrlPMixed|, search in files, buffers and MRU files.
1571
1572 Before 2012/03/31~
1573
1574 + New options: |g:ctrlp_default_input|, default input when entering CtrlP.
1575 |g:ctrlp_match_func|, allow using a custom fuzzy matcher.
1576 + Rename:
1577 *ClearCtrlPCache* -> |CtrlPClearCache|
1578 *ClearAllCtrlPCaches* -> |CtrlPClearAllCaches|
1579 *ResetCtrlP* -> |CtrlPReload|
1580
1581 Before 2012/03/02~
1582
1583 + Rename:
1584 *g:ctrlp_regexp_search* -> |g:ctrlp_regexp|,
1585 *g:ctrlp_dont_split* -> |g:ctrlp_reuse_window|,
1586 *g:ctrlp_jump_to_buffer* -> |g:ctrlp_switch_buffer|.
1587 + Rename and tweak:
1588 *g:ctrlp_open_multi* -> |g:ctrlp_open_multiple_files|.
1589 + Deprecate *g:ctrlp_highlight_match*
1590 + Extend |g:ctrlp_user_command| to support multiple commands.
1591 + New option: |g:ctrlp_mruf_last_entered| change MRU to Recently-Entered.
1592
1593 Before 2012/01/15~
1594
1595 + New mapping: Switch <tab> and <s-tab>. <tab> is now used for completion
1596 of directory names under the current working directory.
1597 + New options: |g:ctrlp_arg_map| for <c-y>, <c-o> to accept an argument.
1598 |g:ctrlp_status_func| custom statusline.
1599 |g:ctrlp_mruf_relative| show only MRU files inside cwd.
1600 + Extend g:ctrlp_open_multi with new optional values: tr, hr, vr.
1601 + Extend |g:ctrlp_custom_ignore| to specifically filter dir, file and link.
1602
1603 Before 2012/01/05~
1604
1605 + New feature: Buffer Tag extension.
1606 + New commands: |:CtrlPBufTag|, |:CtrlPBufTagAll|.
1607 + New options: |g:ctrlp_cmd|,
1608 |g:ctrlp_custom_ignore|
1609
1610 Before 2011/11/30~
1611
1612 + New features: Tag, Quickfix and Directory extensions.
1613 + New commands: |:CtrlPTag|, |:CtrlPQuickfix|, |:CtrlPDir|.
1614 + New options: |g:ctrlp_use_migemo|,
1615 |g:ctrlp_lazy_update|,
1616 |g:ctrlp_follow_symlinks|
1617
1618 Before 2011/11/13~
1619
1620 + New special input: '/' and '\' find root (|ctrlp-input-formats| (e))
1621 + Remove ctrlp#SetWorkingPath().
1622 + Remove *g:ctrlp_mru_files* and make MRU mode permanent.
1623 + Extend g:ctrlp_open_multi, add new ways to open files.
1624 + New option: g:ctrlp_dont_split,
1625 |g:ctrlp_mruf_case_sensitive|
1626
1627 Before 2011/10/30~
1628
1629 + New feature: Support for custom extensions.
1630 <F5> also removes non-existent files from MRU list.
1631 + New option: g:ctrlp_jump_to_buffer
1632
1633 Before 2011/10/12~
1634
1635 + New features: Open multiple files.
1636 Pass Vim's |++opt| and |+cmd| to the opening file
1637 (|ctrlp-input-formats| (c))
1638 Auto-complete each dir for |:CtrlP| [starting-directory]
1639 + New mappings: <c-z> mark/unmark a file to be opened with <c-o>.
1640 <c-o> open all marked files.
1641 + New option: g:ctrlp_open_multi
1642 + Remove *g:ctrlp_persistent_input* *g:ctrlp_live_update* and <c-^>.
1643
1644 Before 2011/09/29~
1645
1646 + New mappings: <c-n>, <c-p> next/prev string in the input history.
1647 <c-y> create a new file and its parent dirs.
1648 + New options: |g:ctrlp_open_new_file|,
1649 |g:ctrlp_max_history|
1650 + Added a new open-in-horizontal-split mapping: <c-x>
1651
1652 Before 2011/09/19~
1653
1654 + New command: ResetCtrlP
1655 + New options: |g:ctrlp_max_files|,
1656 |g:ctrlp_max_depth|,
1657 g:ctrlp_live_update
1658 + New mapping: <c-^>
1659
1660 Before 2011/09/12~
1661
1662 + Ability to cycle through matched lines in the match window.
1663 + Extend the behavior of g:ctrlp_persistent_input
1664 + Extend the behavior of |:CtrlP|
1665 + New options: |g:ctrlp_dotfiles|,
1666 |g:ctrlp_clear_cache_on_exit|,
1667 g:ctrlp_highlight_match,
1668 |g:ctrlp_user_command|
1669 + New special input: '..' (|ctrlp-input-formats| (d))
1670 + New mapping: <F5>.
1671 + New commands: |:CtrlPCurWD|,
1672 |:CtrlPCurFile|,
1673 |:CtrlPRoot|
1674
1675 + New feature: Search in most recently used (MRU) files
1676 + New mapping: <c-b>.
1677 + Extended the behavior of <c-f>.
1678 + New options: g:ctrlp_mru_files,
1679 |g:ctrlp_mruf_max|,
1680 |g:ctrlp_mruf_exclude|,
1681 |g:ctrlp_mruf_include|
1682 + New command: |:CtrlPMRU|
1683
1684 First public release: 2011/09/06~
1685
1686 ===============================================================================
1687 vim:ft=help:et:ts=2:sw=2:sts=2:norl