ctrlp.txt 52 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406
  1. *ctrlp.txt* Fuzzy file, buffer, mru, tag, ... finder. v1.79
  2. *CtrlP* *ControlP* *'ctrlp'* *'ctrl-p'*
  3. ===============================================================================
  4. # #
  5. # :::::::: ::::::::::: ::::::::: ::: ::::::::: #
  6. # :+: :+: :+: :+: :+: :+: :+: :+: #
  7. # +:+ +:+ +:+ +:+ +:+ +:+ +:+ #
  8. # +#+ +#+ +#++:++#: +#+ +#++:++#+ #
  9. # +#+ +#+ +#+ +#+ +#+ +#+ #
  10. # #+# #+# #+# #+# #+# #+# #+# #
  11. # ######## ### ### ### ########## ### #
  12. # #
  13. ===============================================================================
  14. CONTENTS *ctrlp-contents*
  15. 1. Intro........................................|ctrlp-intro|
  16. 2. Options......................................|ctrlp-options|
  17. 3. Commands.....................................|ctrlp-commands|
  18. 4. Mappings.....................................|ctrlp-mappings|
  19. 5. Input Formats................................|ctrlp-input-formats|
  20. 6. Extensions...................................|ctrlp-extensions|
  21. ===============================================================================
  22. INTRO *ctrlp-intro*
  23. Full path fuzzy file, buffer, mru, tag, ... finder with an intuitive interface.
  24. Written in pure Vimscript for MacVim, gVim and Vim version 7.0+. Has full
  25. support for Vim's |regexp| as search pattern, built-in MRU files monitoring,
  26. project's root finder, and more.
  27. To enable optional extensions (tag, dir, rtscript...), see |ctrlp-extensions|.
  28. ===============================================================================
  29. OPTIONS *ctrlp-options*
  30. Overview:~
  31. |loaded_ctrlp|................Disable the plugin.
  32. |ctrlp_map|...................Default mapping.
  33. |ctrlp_cmd|...................Default command used for the default mapping.
  34. |ctrlp_by_filename|...........Default to filename mode or not.
  35. |ctrlp_regexp|................Default to regexp mode or not.
  36. |ctrlp_match_window_bottom|...Where to show the match window.
  37. |ctrlp_match_window_reversed|.Sort order in the match window.
  38. |ctrlp_max_height|............Max height of the match window.
  39. |ctrlp_switch_buffer|.........Jump to an open buffer if already opened.
  40. |ctrlp_reuse_window|..........Reuse special windows (help, quickfix, etc).
  41. |ctrlp_tabpage_position|......Where to put the new tab page.
  42. |ctrlp_working_path_mode|.....How to set CtrlP's local working directory.
  43. |ctrlp_root_markers|..........Additional, high priority root markers.
  44. |ctrlp_use_caching|...........Use per-session caching or not.
  45. |ctrlp_clear_cache_on_exit|...Keep cache after exiting Vim or not.
  46. |ctrlp_cache_dir|.............Location of the cache directory.
  47. |ctrlp_show_hidden|...........Ignore dotfiles and dotdirs or not.
  48. |ctrlp_custom_ignore|.........Hide stuff when using |globpath()|.
  49. |ctrlp_max_files|.............Number of files to scan initially.
  50. |ctrlp_max_depth|.............Directory depth to recurse into when scanning.
  51. |ctrlp_user_command|..........Use an external scanner.
  52. |ctrlp_max_history|...........Number of entries saved in the prompt history.
  53. |ctrlp_open_new_file|.........How to open a file created by <c-y>.
  54. |ctrlp_open_multiple_files|...How to open files selected by <c-z>.
  55. |ctrlp_arg_map|...............Intercept <c-y> and <c-o> or not.
  56. |ctrlp_follow_symlinks|.......Follow symbolic links or not.
  57. |ctrlp_lazy_update|...........Only update when typing has stopped.
  58. |ctrlp_default_input|.........Seed the prompt with an initial string.
  59. |ctrlp_abbrev|................Input abbreviations.
  60. |ctrlp_key_loop|..............Use input looping for multi-byte input.
  61. |ctrlp_use_migemo|............Use Migemo patterns for Japanese filenames.
  62. |ctrlp_prompt_mappings|.......Change the mappings inside the prompt.
  63. MRU mode:
  64. |ctrlp_mruf_max|..............Max MRU entries to remember.
  65. |ctrlp_mruf_exclude|..........Files that shouldn't be remembered.
  66. |ctrlp_mruf_include|..........Files to be remembered.
  67. |ctrlp_mruf_relative|.........Show only MRU files in the working directory.
  68. |ctrlp_mruf_default_order|....Disable sorting.
  69. |ctrlp_mruf_case_sensitive|...MRU files are case sensitive or not.
  70. |ctrlp_mruf_save_on_update|...Save to disk whenever a new entry is added.
  71. Advanced options:
  72. |ctrlp_open_func|.............Use custom file opening functions.
  73. |ctrlp_status_func|...........Change CtrlP's two statuslines.
  74. |ctrlp_buffer_func|...........Call custom functions in the CtrlP buffer.
  75. |ctrlp_match_func|............Replace the built-in matching algorithm.
  76. -------------------------------------------------------------------------------
  77. Detailed descriptions and default values:~
  78. *'g:ctrlp_map'*
  79. Use this option to change the mapping to invoke CtrlP in |Normal| mode: >
  80. let g:ctrlp_map = '<c-p>'
  81. <
  82. *'g:ctrlp_cmd'*
  83. Set the default opening command to use when pressing the above mapping: >
  84. let g:ctrlp_cmd = 'CtrlP'
  85. <
  86. *'g:loaded_ctrlp'*
  87. Use this to disable the plugin completely: >
  88. let g:loaded_ctrlp = 1
  89. <
  90. *'g:ctrlp_by_filename'*
  91. Set this to 1 to set searching by filename (as opposed to full path) as the
  92. default: >
  93. let g:ctrlp_by_filename = 0
  94. <
  95. Can be toggled on/off by pressing <c-d> inside the prompt.
  96. *'g:ctrlp_regexp'*
  97. Set this to 1 to set regexp search as the default: >
  98. let g:ctrlp_regexp = 0
  99. <
  100. Can be toggled on/off by pressing <c-r> inside the prompt.
  101. *'g:ctrlp_match_window_bottom'*
  102. Set this to 0 to show the match window at the top of the screen: >
  103. let g:ctrlp_match_window_bottom = 1
  104. <
  105. *'g:ctrlp_match_window_reversed'*
  106. Change the listing order of the files in the match window. The default setting
  107. (1) is from bottom to top: >
  108. let g:ctrlp_match_window_reversed = 1
  109. <
  110. *'g:ctrlp_max_height'*
  111. Set the maximum height of the match window: >
  112. let g:ctrlp_max_height = 10
  113. <
  114. *'g:ctrlp_switch_buffer'*
  115. When opening a file, if it's already open in a window somewhere, CtrlP will try
  116. to jump to it instead of opening a new instance: >
  117. let g:ctrlp_switch_buffer = 'Et'
  118. <
  119. e - jump when <cr> is pressed, but only to windows in the current tab.
  120. t - jump when <c-t> is pressed, but only to windows in another tab.
  121. v - like "e", but jump when <c-v> is pressed.
  122. h - like "e", but jump when <c-x> is pressed.
  123. E, T, V, H - like "e", "t", "v", and "h", but jump to windows anywhere.
  124. 0 or <empty> - disable this feature.
  125. *'g:ctrlp_reuse_window'*
  126. When opening a file with <cr>, CtrlP avoids opening it in windows created by
  127. plugins, help and quickfix. Use this to setup some exceptions: >
  128. let g:ctrlp_reuse_window = 'netrw'
  129. <
  130. Acceptable values are partial name, filetype or buftype of the special buffers.
  131. Use regexp to specify the pattern.
  132. Example: >
  133. let g:ctrlp_reuse_window = 'netrw\|help\|quickfix'
  134. <
  135. *'g:ctrlp_tabpage_position'*
  136. Where to put the new tab page when opening one: >
  137. let g:ctrlp_tabpage_position = 'ac'
  138. <
  139. a - after.
  140. b - before.
  141. c - the current tab page.
  142. l - the last tab page.
  143. f - the first tab page.
  144. *'g:ctrlp_working_path_mode'*
  145. When starting up, CtrlP sets its local working directory according to this
  146. variable: >
  147. let g:ctrlp_working_path_mode = 'ra'
  148. <
  149. c - the directory of the current file.
  150. a - like "c", but only applies when the current working directory outside of
  151. CtrlP isn't a direct ancestor of the directory of the current file.
  152. r - the nearest ancestor that contains one of these directories or files:
  153. .git .hg .svn .bzr _darcs
  154. w - begin finding a root from the current working directory outside of CtrlP
  155. instead of from the directory of the current file (default). Only applies
  156. when "r" is also present.
  157. 0 or <empty> - disable this feature.
  158. Note #1: if "a" or "c" is included with "r", use the behavior of "a" or "c" (as
  159. a fallback) when a root can't be found.
  160. Note #2: you can use a |b:var| to set this option on a per buffer basis.
  161. *'g:ctrlp_root_markers'*
  162. Use this to set your own root markers in addition to the default ones (.git,
  163. .hg, .svn, .bzr, and _darcs). Your markers will take precedence: >
  164. let g:ctrlp_root_markers = ['']
  165. <
  166. Note: you can use a |b:var| to set this option on a per buffer basis.
  167. *'g:ctrlp_use_caching'*
  168. Enable/Disable per-session caching: >
  169. let g:ctrlp_use_caching = 1
  170. <
  171. 0 - Disable caching.
  172. 1 - Enable caching.
  173. n - When bigger than 1, disable caching and use the number as the limit to
  174. enable caching again.
  175. Note: you can quickly purge the cache by pressing <F5> while inside CtrlP.
  176. *'g:ctrlp_clear_cache_on_exit'*
  177. Set this to 0 to enable cross-session caching by not deleting the cache files
  178. upon exiting Vim: >
  179. let g:ctrlp_clear_cache_on_exit = 1
  180. <
  181. *'g:ctrlp_cache_dir'*
  182. Set the directory to store the cache files: >
  183. let g:ctrlp_cache_dir = $HOME.'/.cache/ctrlp'
  184. <
  185. *'g:ctrlp_show_hidden'*
  186. Set this to 1 if you want CtrlP to scan for dotfiles and dotdirs: >
  187. let g:ctrlp_show_hidden = 0
  188. <
  189. Note: does not apply when a command defined with |g:ctrlp_user_command| is
  190. being used.
  191. *'ctrlp-wildignore'*
  192. You can use Vim's |'wildignore'| to exclude files and directories from the
  193. results.
  194. Examples: >
  195. " Excluding version control directories
  196. set wildignore+=*/.git/*,*/.hg/*,*/.svn/* " Linux/MacOSX
  197. set wildignore+=*\\.git\\*,*\\.hg\\*,*\\.svn\\* " Windows ('noshellslash')
  198. <
  199. Note #1: the `*/` in front of each directory glob is required.
  200. Note #2: |wildignore| influences the result of |expand()|, |globpath()| and
  201. |glob()| which many plugins use to find stuff on the system (e.g. VCS related
  202. plugins look for .git/, .hg/,... some other plugins look for external *.exe
  203. tools on Windows). So be a little mindful of what you put in your |wildignore|.
  204. *'g:ctrlp_custom_ignore'*
  205. In addition to |'wildignore'|, use this for files and directories you want only
  206. CtrlP to not show. Use regexp to specify the patterns: >
  207. let g:ctrlp_custom_ignore = ''
  208. <
  209. Examples: >
  210. let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
  211. let g:ctrlp_custom_ignore = {
  212. \ 'dir': '\v[\/]\.(git|hg|svn)$',
  213. \ 'file': '\v\.(exe|so|dll)$',
  214. \ 'link': 'SOME_BAD_SYMBOLIC_LINKS',
  215. \ }
  216. let g:ctrlp_custom_ignore = {
  217. \ 'file': '\v(\.cpp|\.h|\.hh|\.cxx)@<!$'
  218. \ }
  219. <
  220. Note #1: by default, |wildignore| and |g:ctrlp_custom_ignore| only apply when
  221. |globpath()| is used to scan for files, thus these options do not apply when a
  222. command defined with |g:ctrlp_user_command| is being used.
  223. Note #2: when changing the option's variable type, remember to |:unlet| it
  224. first or restart Vim to avoid the "E706: Variable type mismatch" error.
  225. *'g:ctrlp_max_files'*
  226. The maximum number of files to scan, set to 0 for no limit: >
  227. let g:ctrlp_max_files = 10000
  228. <
  229. Note: does not apply when a command defined with |g:ctrlp_user_command| is
  230. being used.
  231. *'g:ctrlp_max_depth'*
  232. The maximum depth of a directory tree to recurse into: >
  233. let g:ctrlp_max_depth = 40
  234. <
  235. Note: does not apply when a command defined with |g:ctrlp_user_command| is
  236. being used.
  237. *'g:ctrlp_user_command'*
  238. Specify an external tool to use for listing files instead of using Vim's
  239. |globpath()|. Use %s in place of the target directory: >
  240. let g:ctrlp_user_command = ''
  241. <
  242. Examples: >
  243. let g:ctrlp_user_command = 'find %s -type f' " MacOSX/Linux
  244. let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d' " Windows
  245. <
  246. You can also use 'grep', 'findstr' or something else to filter the results.
  247. Examples: >
  248. let g:ctrlp_user_command =
  249. \ 'find %s -type f | grep -v -P "\.jpg$|/tmp/"' " MacOSX/Linux
  250. let g:ctrlp_user_command =
  251. \ 'dir %s /-n /b /s /a-d | findstr /v /l ".jpg \\tmp\\"' " Windows
  252. <
  253. Use a version control listing command when inside a repository, this is faster
  254. when scanning large projects: >
  255. let g:ctrlp_user_command = [root_marker, listing_command, fallback_command]
  256. let g:ctrlp_user_command = {
  257. \ 'types': {
  258. \ 1: [root_marker_1, listing_command_1],
  259. \ n: [root_marker_n, listing_command_n],
  260. \ },
  261. \ 'fallback': fallback_command,
  262. \ 'ignore': 0 or 1
  263. \ }
  264. <
  265. Some examples: >
  266. " Single VCS, listing command does not list untracked files:
  267. let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files']
  268. let g:ctrlp_user_command = ['.hg', 'hg --cwd %s locate -I .']
  269. " Multiple VCS's:
  270. let g:ctrlp_user_command = {
  271. \ 'types': {
  272. \ 1: ['.git', 'cd %s && git ls-files'],
  273. \ 2: ['.hg', 'hg --cwd %s locate -I .'],
  274. \ },
  275. \ 'fallback': 'find %s -type f'
  276. \ }
  277. " Single VCS, listing command lists untracked files (slower):
  278. let g:ctrlp_user_command =
  279. \ ['.git', 'cd %s && git ls-files . -co --exclude-standard']
  280. let g:ctrlp_user_command =
  281. \ ['.hg', 'hg --cwd %s status -numac -I . $(hg root)'] " MacOSX/Linux
  282. let g:ctrlp_user_command = ['.hg', 'for /f "tokens=1" %%a in (''hg root'') '
  283. \ . 'do hg --cwd %s status -numac -I . %%a'] " Windows
  284. <
  285. Note #1: if the fallback_command is empty or the 'fallback' key is not defined,
  286. |globpath()| will then be used when scanning outside of a repository.
  287. Note #2: unless the |Dictionary| format is used and 'ignore' is defined and set
  288. to 1, the |wildignore| and |g:ctrlp_custom_ignore| options do not apply when
  289. these custom commands are being used. When not present, 'ignore' is set to 0 by
  290. default to retain the performance advantage of using external commands.
  291. Note #3: when changing the option's variable type, remember to |:unlet| it
  292. first or restart Vim to avoid the "E706: Variable type mismatch" error.
  293. Note #4: you can use a |b:var| to set this option on a per buffer basis.
  294. *'g:ctrlp_max_history'*
  295. The maximum number of input strings you want CtrlP to remember. The default
  296. value mirrors Vim's global |'history'| option: >
  297. let g:ctrlp_max_history = &history
  298. <
  299. Set to 0 to disable prompt's history. Browse the history with <c-n> and <c-p>.
  300. *'g:ctrlp_open_new_file'*
  301. Use this option to specify how the newly created file is to be opened when
  302. pressing <c-y>: >
  303. let g:ctrlp_open_new_file = 'v'
  304. <
  305. t - in a new tab.
  306. h - in a new horizontal split.
  307. v - in a new vertical split.
  308. r - in the current window.
  309. *'g:ctrlp_open_multiple_files'*
  310. If non-zero, this will enable opening multiple files with <c-z> and <c-o>: >
  311. let g:ctrlp_open_multiple_files = 'v'
  312. <
  313. Example: >
  314. let g:ctrlp_open_multiple_files = '2vjr'
  315. <
  316. For the number:
  317. - If given, it'll be used as the maximum number of windows or tabs to create
  318. when opening the files (the rest will be opened as hidden buffers).
  319. - If not given, <c-o> will open all files, each in a new window or new tab.
  320. For the letters:
  321. t - each file in a new tab.
  322. h - each file in a new horizontal split.
  323. v - each file in a new vertical split.
  324. i - all files as hidden buffers.
  325. j - after opening, jump to the first opened tab or window.
  326. r - open the first file in the current window, then the remaining files in
  327. new splits or new tabs depending on which of "h", "v" and "t" is also
  328. present.
  329. *'g:ctrlp_arg_map'*
  330. When this is set to 1, the <c-o> and <c-y> mappings will accept one extra key
  331. as an argument to override their default behavior: >
  332. let g:ctrlp_arg_map = 0
  333. <
  334. Pressing <c-o> or <c-y> will then prompt for a keypress. The key can be:
  335. t - open in tab(s)
  336. h - open in horizontal split(s)
  337. v - open in vertical split(s)
  338. i - open as hidden buffers (for <c-o> only)
  339. c - clear the marked files (for <c-o> only)
  340. r - open in the current window (for <c-y> only)
  341. <esc>, <c-c>, <c-u> - cancel and go back to the prompt.
  342. <cr> - use the default behavior specified with |g:ctrlp_open_new_file| and
  343. |g:ctrlp_open_multiple_files|.
  344. *'g:ctrlp_follow_symlinks'*
  345. If non-zero, CtrlP will follow symbolic links when listing files: >
  346. let g:ctrlp_follow_symlinks = 0
  347. <
  348. 0 - don't follow symbolic links.
  349. 1 - follow but ignore looped internal symlinks to avoid duplicates.
  350. 2 - follow all symlinks indiscriminately.
  351. Note: does not apply when a command defined with |g:ctrlp_user_command| is
  352. being used.
  353. *'g:ctrlp_lazy_update'*
  354. Set this to 1 to enable the lazy-update feature: only update the match window
  355. after typing's been stopped for a certain amount of time: >
  356. let g:ctrlp_lazy_update = 0
  357. <
  358. If is 1, update after 250ms. If bigger than 1, the number will be used as the
  359. delay time in milliseconds.
  360. *'g:ctrlp_default_input'*
  361. Set this to 1 to enable seeding the prompt with the current file's relative
  362. path: >
  363. let g:ctrlp_default_input = 0
  364. <
  365. Instead of 1 or 0, if the value of the option is a string, it'll be used as-is
  366. as the default input: >
  367. let g:ctrlp_default_input = 'anystring'
  368. <
  369. *'g:ctrlp_abbrev'*
  370. Define input abbreviations that can be expanded (either internally or visibly)
  371. in the prompt: >
  372. let g:ctrlp_abbrev = {}
  373. <
  374. Examples: >
  375. let g:ctrlp_abbrev = {
  376. \ 'gmode': 'i',
  377. \ 'abbrevs': [
  378. \ {
  379. \ 'pattern': '^cd b',
  380. \ 'expanded': '@cd ~/.vim/bundle',
  381. \ 'mode': 'pfrz',
  382. \ },
  383. \ {
  384. \ 'pattern': '\(^@.\+\|\\\@<!:.\+\)\@<! ',
  385. \ 'expanded': '.\{-}',
  386. \ 'mode': 'pfr',
  387. \ },
  388. \ {
  389. \ 'pattern': '\\\@<!:.\+\zs\\\@<! ',
  390. \ 'expanded': '\ ',
  391. \ 'mode': 'pfz',
  392. \ },
  393. \ ]
  394. \ }
  395. <
  396. The 'pattern' string is regexp matched against the entered input. The expansion
  397. is as if the 'expanded' string was typed into the prompt.
  398. For 'gmode' (optional):
  399. i - expand internally (default).
  400. t - insert the expanded results into the prompt as you type.
  401. k - insert the expanded results when a non-keyword character is typed. Only
  402. applies when "t" is also present.
  403. For 'mode' (of each entry; optional):
  404. f - only in filename mode.
  405. p - only in full path mode.
  406. r - only in regexp mode.
  407. z - only in fuzzy mode.
  408. n - only when creating a new file with <c-y> (use the expanded string in the
  409. new filename).
  410. c - only when auto-completing directory names with <tab> (expand the pattern
  411. immediately before doing the auto-completion).
  412. <empty> or not defined - always enable.
  413. Note: the abbrev entries are evaluated in sequence, so a later entry can be
  414. evaluated against the expanded result of a previous entry; this includes itself
  415. when 'gmode' is "t".
  416. *'g:ctrlp_key_loop'*
  417. An experimental feature. Set this to 1 to enable input looping for the typing
  418. of multi-byte characters: >
  419. let g:ctrlp_key_loop = 0
  420. <
  421. Note #1: when set, this option resets the |g:ctrlp_lazy_update| option.
  422. Note #2: you can toggle this feature inside the prompt with a custom mapping: >
  423. let g:ctrlp_prompt_mappings = { 'ToggleKeyLoop()': ['<F3>'] }
  424. <
  425. *'g:ctrlp_use_migemo'*
  426. Set this to 1 to use Migemo Pattern for Japanese filenames. Migemo Search only
  427. works in regexp mode. To split the pattern, separate words with space: >
  428. let g:ctrlp_use_migemo = 0
  429. <
  430. *'g:ctrlp_prompt_mappings'*
  431. Use this to customize the mappings inside CtrlP's prompt to your liking. You
  432. only need to keep the lines that you've changed the values (inside []): >
  433. let g:ctrlp_prompt_mappings = {
  434. \ 'PrtBS()': ['<bs>', '<c-]>'],
  435. \ 'PrtDelete()': ['<del>'],
  436. \ 'PrtDeleteWord()': ['<c-w>'],
  437. \ 'PrtClear()': ['<c-u>'],
  438. \ 'PrtSelectMove("j")': ['<c-j>', '<down>'],
  439. \ 'PrtSelectMove("k")': ['<c-k>', '<up>'],
  440. \ 'PrtSelectMove("t")': ['<Home>', '<kHome>'],
  441. \ 'PrtSelectMove("b")': ['<End>', '<kEnd>'],
  442. \ 'PrtSelectMove("u")': ['<PageUp>', '<kPageUp>'],
  443. \ 'PrtSelectMove("d")': ['<PageDown>', '<kPageDown>'],
  444. \ 'PrtHistory(-1)': ['<c-n>'],
  445. \ 'PrtHistory(1)': ['<c-p>'],
  446. \ 'AcceptSelection("e")': ['<cr>', '<2-LeftMouse>'],
  447. \ 'AcceptSelection("h")': ['<c-x>', '<c-cr>', '<c-s>'],
  448. \ 'AcceptSelection("t")': ['<c-t>'],
  449. \ 'AcceptSelection("v")': ['<c-v>', '<RightMouse>'],
  450. \ 'ToggleFocus()': ['<s-tab>'],
  451. \ 'ToggleRegex()': ['<c-r>'],
  452. \ 'ToggleByFname()': ['<c-d>'],
  453. \ 'ToggleType(1)': ['<c-f>', '<c-up>'],
  454. \ 'ToggleType(-1)': ['<c-b>', '<c-down>'],
  455. \ 'PrtExpandDir()': ['<tab>'],
  456. \ 'PrtInsert("c")': ['<MiddleMouse>', '<insert>'],
  457. \ 'PrtInsert()': ['<c-\>'],
  458. \ 'PrtCurStart()': ['<c-a>'],
  459. \ 'PrtCurEnd()': ['<c-e>'],
  460. \ 'PrtCurLeft()': ['<c-h>', '<left>', '<c-^>'],
  461. \ 'PrtCurRight()': ['<c-l>', '<right>'],
  462. \ 'PrtClearCache()': ['<F5>'],
  463. \ 'PrtDeleteEnt()': ['<F7>'],
  464. \ 'CreateNewFile()': ['<c-y>'],
  465. \ 'MarkToOpen()': ['<c-z>'],
  466. \ 'OpenMulti()': ['<c-o>'],
  467. \ 'PrtExit()': ['<esc>', '<c-c>', '<c-g>'],
  468. \ }
  469. <
  470. Note: if pressing <bs> moves the cursor one character to the left instead of
  471. deleting a character for you, add this to your |.vimrc| to disable the plugin's
  472. default <c-h> mapping: >
  473. let g:ctrlp_prompt_mappings = { 'PrtCurLeft()': ['<left>', '<c-^>'] }
  474. <
  475. ----------------------------------------
  476. MRU mode options:~
  477. *'g:ctrlp_mruf_max'*
  478. Specify the number of recently opened files you want CtrlP to remember: >
  479. let g:ctrlp_mruf_max = 250
  480. <
  481. *'g:ctrlp_mruf_exclude'*
  482. Files you don't want CtrlP to remember. Use regexp to specify the patterns: >
  483. let g:ctrlp_mruf_exclude = ''
  484. <
  485. Examples: >
  486. let g:ctrlp_mruf_exclude = '/tmp/.*\|/temp/.*' " MacOSX/Linux
  487. let g:ctrlp_mruf_exclude = '^C:\\dev\\tmp\\.*' " Windows
  488. <
  489. *'g:ctrlp_mruf_include'*
  490. And if you want CtrlP to only remember some files, specify them here: >
  491. let g:ctrlp_mruf_include = ''
  492. <
  493. Example: >
  494. let g:ctrlp_mruf_include = '\.py$\|\.rb$'
  495. <
  496. *'g:ctrlp_mruf_relative'*
  497. Set this to 1 to show only MRU files in the current working directory: >
  498. let g:ctrlp_mruf_relative = 0
  499. <
  500. *'g:ctrlp_mruf_default_order'*
  501. Set this to 1 to disable sorting when searching in MRU mode: >
  502. let g:ctrlp_mruf_default_order = 0
  503. <
  504. *'g:ctrlp_mruf_case_sensitive'*
  505. Match this with your file system case-sensitivity setting to avoid duplicate
  506. MRU entries: >
  507. let g:ctrlp_mruf_case_sensitive = 1
  508. <
  509. *'g:ctrlp_mruf_save_on_update'*
  510. Set this to 0 to disable saving of the MRU list to hard drive whenever a new
  511. entry is added, saving will then only occur when exiting Vim: >
  512. let g:ctrlp_mruf_save_on_update = 1
  513. <
  514. ----------------------------------------
  515. Advanced options:~
  516. *'g:ctrlp_open_func'*
  517. Define a custom function to open the selected file: >
  518. let g:ctrlp_open_func = {}
  519. <
  520. Example: >
  521. let g:ctrlp_open_func = {
  522. \ 'files' : 'Function_Name_1',
  523. \ 'buffers' : 'Function_Name_2',
  524. \ 'mru files' : 'Function_Name_3',
  525. \ }
  526. <
  527. Structure of the functions: >
  528. function! Function_Name(action, line)
  529. " Arguments:
  530. " |
  531. " +- a:action : The opening action:
  532. " | + 'e' : user pressed <cr> (default)
  533. " | + 'h' : user pressed <c-x> (default)
  534. " | + 'v' : user pressed <c-v> (default)
  535. " | + 't' : user pressed <c-t> (default)
  536. " | + 'x' : user used the <c-o> console dialog (default) and
  537. " | chose "e[x]ternal".
  538. " |
  539. " +- a:line : The selected line.
  540. endfunction
  541. <
  542. Note: does not apply when opening multiple files with <c-z> and <c-o>.
  543. Example: open HTML files in the default web browser when <c-t> is pressed and
  544. in Vim otherwise >
  545. function! HTMLOpenFunc(action, line)
  546. if a:action =~ '^[tx]$' && fnamemodify(a:line, ':e') =~? '^html\?$'
  547. " Get the filename
  548. let filename = fnameescape(fnamemodify(a:line, ':p'))
  549. " Close CtrlP
  550. call ctrlp#exit()
  551. " Open the file
  552. silent! execute '!xdg-open' filename
  553. elseif a:action == 'x' && fnamemodify(a:line, ':e') !~? '^html\?$'
  554. " Not a HTML file, simulate pressing <c-o> again and wait for new input
  555. call feedkeys("\<c-o>")
  556. else
  557. " Use CtrlP's default file opening function
  558. call call('ctrlp#acceptfile', [a:action, a:line])
  559. endif
  560. endfunction
  561. let g:ctrlp_open_func = { 'files': 'HTMLOpenFunc' }
  562. <
  563. *'g:ctrlp_status_func'*
  564. Use this to customize the statuslines for the CtrlP window: >
  565. let g:ctrlp_status_func = {}
  566. <
  567. Example: >
  568. let g:ctrlp_status_func = {
  569. \ 'main': 'Function_Name_1',
  570. \ 'prog': 'Function_Name_2',
  571. \ }
  572. <
  573. Structure of the functions: >
  574. " Main statusline
  575. function! Function_Name_1(focus, byfname, regex, prev, item, next, marked)
  576. " Arguments:
  577. " |
  578. " +- a:focus : The focus of the prompt: "prt" or "win".
  579. " |
  580. " +- a:byfname : In filename mode or in full path mode: "file" or "path".
  581. " |
  582. " +- a:regex : In regex mode: 1 or 0.
  583. " |
  584. " +- a:prev : The previous search mode.
  585. " |
  586. " +- a:item : The current search mode.
  587. " |
  588. " +- a:next : The next search mode.
  589. " |
  590. " +- a:marked : The number of marked files, or a comma separated list of
  591. " the marked filenames.
  592. return full_statusline
  593. endfunction
  594. " Progress statusline
  595. function! Function_Name_2(str)
  596. " a:str : Either the number of files scanned so far, or a string indicating
  597. " the current directory is being scanned with a user_command.
  598. return full_statusline
  599. endfunction
  600. <
  601. See https://gist.github.com/1610859 for a working example.
  602. *'g:ctrlp_buffer_func'*
  603. Specify the functions that will be called after entering and before exiting the
  604. CtrlP buffer: >
  605. let g:ctrlp_buffer_func = {}
  606. <
  607. Example: >
  608. let g:ctrlp_buffer_func = {
  609. \ 'enter': 'Function_Name_1',
  610. \ 'exit': 'Function_Name_2',
  611. \ }
  612. <
  613. *'g:ctrlp_match_func'*
  614. Set an external fuzzy matching function for CtrlP to use: >
  615. let g:ctrlp_match_func = {}
  616. <
  617. Example: >
  618. let g:ctrlp_match_func = { 'match': 'Function_Name' }
  619. <
  620. Structure of the function: >
  621. function! Function_Name(items, str, limit, mmode, ispath, crfile, regex)
  622. " Arguments:
  623. " |
  624. " +- a:items : The full list of items to search in.
  625. " |
  626. " +- a:str : The string entered by the user.
  627. " |
  628. " +- a:limit : The max height of the match window. Can be used to limit
  629. " | the number of items to return.
  630. " |
  631. " +- a:mmode : The match mode. Can be one of these strings:
  632. " | + "full-line": match the entire line.
  633. " | + "filename-only": match only the filename.
  634. " | + "first-non-tab": match until the first tab char.
  635. " | + "until-last-tab": match until the last tab char.
  636. " |
  637. " +- a:ispath : Is 1 when searching in file, buffer, mru, mixed, dir, and
  638. " | rtscript modes. Is 0 otherwise.
  639. " |
  640. " +- a:crfile : The file in the current window. Should be excluded from the
  641. " | results when a:ispath == 1.
  642. " |
  643. " +- a:regex : In regex mode: 1 or 0.
  644. return list_of_matched_items
  645. endfunction
  646. <
  647. ===============================================================================
  648. COMMANDS *ctrlp-commands*
  649. *:CtrlP*
  650. :CtrlP [starting-directory]
  651. Open CtrlP in find file mode.
  652. If no argument is given, the value of |g:ctrlp_working_path_mode| will be
  653. used to determine the starting directory.
  654. You can use <tab> to auto-complete the [starting-directory] when typing it.
  655. *:CtrlPBuffer*
  656. :CtrlPBuffer
  657. Open CtrlP in find buffer mode.
  658. *:CtrlPMRU*
  659. :CtrlPMRU
  660. Open CtrlP in find Most-Recently-Used file mode.
  661. *:CtrlPLastMode*
  662. :CtrlPLastMode [--dir]
  663. Open CtrlP in the last mode used. When having the "--dir" argument, also
  664. reuse the last working directory.
  665. *:CtrlPRoot*
  666. :CtrlPRoot
  667. This acts like |:CtrlP| with |g:ctrlp_working_path_mode| = 'r' and ignores
  668. the variable's current value.
  669. *:CtrlPClearCache*
  670. :CtrlPClearCache
  671. Flush the cache for the current working directory. The same as pressing <F5>
  672. inside CtrlP.
  673. To enable or disable caching, use the |g:ctrlp_use_caching| option.
  674. *:CtrlPClearAllCaches*
  675. :CtrlPClearAllCaches
  676. Delete all the cache files saved in |g:ctrlp_cache_dir| location.
  677. -------------------------------------------------------------------------------
  678. For commands provided by bundled extensions, see |ctrlp-extensions|.
  679. ===============================================================================
  680. MAPPINGS *ctrlp-mappings*
  681. *'ctrlp-<c-p>'*
  682. <c-p>
  683. Default |Normal| mode mapping to open the CtrlP prompt in find file mode.
  684. ----------------------------------------
  685. Once inside the prompt:~
  686. <c-d>
  687. Toggle between full-path search and filename only search.
  688. Note: in filename mode, the prompt's base is '>d>' instead of '>>>'
  689. <c-r> *'ctrlp-fullregexp'*
  690. Toggle between the string mode and full regexp mode.
  691. Note: in full regexp mode, the prompt's base is 'r>>' instead of '>>>'
  692. See also: |input-formats| (guide) and |g:ctrlp_regexp_search| (option).
  693. <c-f>, 'forward'
  694. <c-up>
  695. Scroll to the 'next' search mode in the sequence.
  696. <c-b>, 'backward'
  697. <c-down>
  698. Scroll to the 'previous' search mode in the sequence.
  699. <tab> *'ctrlp-autocompletion'*
  700. Auto-complete directory names under the current working directory inside
  701. the prompt.
  702. <s-tab>
  703. Toggle the focus between the match window and the prompt.
  704. <esc>,
  705. <c-c>
  706. Exit CtrlP.
  707. Moving:~
  708. <c-j>,
  709. <down>
  710. Move selection down.
  711. <c-k>,
  712. <up>
  713. Move selection up.
  714. <c-a>
  715. Move the cursor to the 'start' of the prompt.
  716. <c-e>
  717. Move the cursor to the 'end' of the prompt.
  718. <c-h>,
  719. <left>,
  720. <c-^>
  721. Move the cursor one character to the 'left'.
  722. <c-l>,
  723. <right>
  724. Move the cursor one character to the 'right'.
  725. Editing:~
  726. <c-]>,
  727. <bs>
  728. Delete the preceding character.
  729. <del>
  730. Delete the current character.
  731. <c-w>
  732. Delete a preceding inner word.
  733. <c-u>
  734. Clear the input field.
  735. Browsing input history:~
  736. <c-n>
  737. Next string in the prompt's history.
  738. <c-p>
  739. Previous string in the prompt's history.
  740. Opening/Creating a file:~
  741. <cr>
  742. Open the selected file in the 'current' window if possible.
  743. <c-t>
  744. Open the selected file in a new 'tab'.
  745. <c-v>
  746. Open the selected file in a 'vertical' split.
  747. <c-x>,
  748. <c-cr>,
  749. <c-s>
  750. Open the selected file in a 'horizontal' split.
  751. <c-y>
  752. Create a new file and its parent directories.
  753. Opening multiple files:~
  754. <c-z>
  755. - Mark/unmark a file to be opened with <c-o>.
  756. - Mark/unmark a file to create a new file in its directory using <c-y>.
  757. <c-o>
  758. - Open files marked by <c-z>.
  759. - When no file has been marked by <c-z>, open a console dialog with the
  760. following options:
  761. Open the selected file:
  762. t - in a tab page.
  763. v - in a vertical split.
  764. h - in a horizontal split.
  765. r - in the current window.
  766. i - as a hidden buffer.
  767. x - (optional) with the function defined in |g:ctrlp_open_func|.
  768. Other options (not shown):
  769. a - mark all files in the match window.
  770. d - change CtrlP's local working directory to the selected file's
  771. directory and switch to find file mode.
  772. Function keys:~
  773. <F5>
  774. - Refresh the match window and purge the cache for the current directory.
  775. - Remove deleted files from the MRU list.
  776. <F7>
  777. - Wipe the MRU list.
  778. - Delete MRU entries marked by <c-z>.
  779. Pasting:~
  780. <Insert>, *'ctrlp-pasting'*
  781. <MiddleMouse>
  782. Paste the clipboard content into the prompt.
  783. <c-\>
  784. Open a console dialog to paste <cword>, <cfile>, the content of the search
  785. register, the last visual selection, the clipboard or any register into the
  786. prompt.
  787. Choose your own mappings with |g:ctrlp_prompt_mappings|.
  788. ----------------------------------------
  789. When inside the match window (press <s-tab> to switch):~
  790. a-z
  791. 0-9
  792. ~^-=;`',.+!@#$%&_(){}[]
  793. Cycle through the lines which have the matching first character.
  794. ===============================================================================
  795. INPUT FORMATS *ctrlp-input-formats*
  796. Formats for inputting in the prompt:~
  797. a) Simple string.
  798. E.g. 'abc' is understood internally as 'a[^a]\{-}b[^b]\{-}c'
  799. b) When in regexp mode, the input string's treated as a Vim's regexp |pattern|
  800. without any modification.
  801. E.g. 'abc\d*efg' will be read as 'abc\d*efg'.
  802. See |ctrlp-fullregexp| (keymap) and |g:ctrlp_regexp_search| (option) for
  803. how to enable regexp mode.
  804. c) End the string with a colon ':' followed by a Vim command to execute that
  805. command after opening the file. If you need to use ':' literally, escape it
  806. with a backslash: '\:'. When opening multiple files, the command will be
  807. executed on each opening file.
  808. E.g. Use ':45' to jump to line 45.
  809. Use ':/any\:string' to jump to the first instance of 'any:string'.
  810. Use ':+setf\ myfiletype|50' to set the filetype to 'myfiletype', then
  811. jump to line 50.
  812. Use ':diffthis' when opening multiple files to run |:diffthis| on the
  813. first 4 files.
  814. See also: Vim's |++opt| and |+cmd|.
  815. d) Submit two dots '..' to go upward the directory tree by 1 level. To go up
  816. multiple levels, use one extra dot for each extra level:
  817. >
  818. Raw input Interpreted as
  819. .. ../
  820. ... ../../
  821. .... ../../../
  822. <
  823. Note: if the parent directories are large and uncached, this can be slow.
  824. You can also use '@cd path/' to change CtrlP's local working directory.
  825. Use '@cd %:h' to change to the directory of the current file.
  826. e) Similarly, submit '/' or '\' to find and go to the project's root.
  827. If the project is large, using a VCS listing command to look for files
  828. might help speeding up the intial scan (see |g:ctrlp_user_command| for more
  829. details).
  830. Note: d) and e) only work in file, directory and mixed modes.
  831. f) Type the name of a non-existent file and press <c-y> to create it. Mark a
  832. file with <c-z> to create the new file in the same directory as the marked
  833. file.
  834. E.g. Using 'newdir/newfile.txt' will create a directory named 'newdir' as
  835. well as a file named 'newfile.txt'.
  836. If an entry 'some/old/dirs/oldfile.txt' is marked with <c-z>, then
  837. 'newdir' and 'newfile.txt' will be created under 'some/old/dirs'. The
  838. final path will then be 'some/old/dirs/newdir/newfile.txt'.
  839. Note: use '\' in place of '/' on Windows (if |'shellslash'| is not set).
  840. g) In filename mode (toggle with <c-d>), you can use one primary pattern and
  841. one refining pattern separated by a semicolon. Both patterns work like (a),
  842. or (b) when in regexp mode.
  843. h) Submit ? to open this help file.
  844. ===============================================================================
  845. EXTENSIONS *ctrlp-extensions*
  846. Extensions are optional. To enable an extension, add its name to the variable
  847. g:ctrlp_extensions: >
  848. let g:ctrlp_extensions = ['tag', 'buffertag', 'quickfix', 'dir', 'rtscript',
  849. \ 'undo', 'line', 'changes', 'mixed', 'bookmarkdir']
  850. <
  851. The order of the items will be the order they appear on the statusline and when
  852. using <c-f>, <c-b>.
  853. Available extensions:~
  854. *:CtrlPTag*
  855. * Tag mode:~
  856. - Name: 'tag'
  857. - Command: ":CtrlPTag"
  858. - Search for a tag within a generated central tags file, and jump to the
  859. definition. Use the Vim's option |'tags'| to specify the names and the
  860. locations of the tags file(s).
  861. E.g. set tags+=doc/tags
  862. *:CtrlPBufTag*
  863. *:CtrlPBufTagAll*
  864. * Buffer Tag mode:~
  865. - Name: 'buffertag'
  866. - Commands: ":CtrlPBufTag [buffer]",
  867. ":CtrlPBufTagAll".
  868. - Search for a tag within the current buffer or all listed buffers and jump
  869. to the definition. Requires |exuberant_ctags| or compatible programs.
  870. *:CtrlPQuickfix*
  871. * Quickfix mode:~
  872. - Name: 'quickfix'
  873. - Command: ":CtrlPQuickfix"
  874. - Search for an entry in the current quickfix errors and jump to it.
  875. *:CtrlPDir*
  876. * Directory mode:~
  877. - Name: 'dir'
  878. - Command: ":CtrlPDir [starting-directory]"
  879. - Search for a directory and change the working directory to it.
  880. - Mappings:
  881. + <cr> change the local working directory for CtrlP and keep it open.
  882. + <c-t> change the global working directory (exit).
  883. + <c-v> change the local working directory for the current window (exit).
  884. + <c-x> change the global working directory to CtrlP's current local
  885. working directory (exit).
  886. *:CtrlPRTS*
  887. * Runtime script mode:~
  888. - Name: 'rtscript'
  889. - Command: ":CtrlPRTS"
  890. - Search for files (vimscripts, docs, snippets...) in runtimepath.
  891. *:CtrlPUndo*
  892. * Undo mode:~
  893. - Name: 'undo'
  894. - Command: ":CtrlPUndo"
  895. - Browse undo history.
  896. *:CtrlPLine*
  897. * Line mode:~
  898. - Name: 'line'
  899. - Command: ":CtrlPLine"
  900. - Search for a line in all listed buffers.
  901. *:CtrlPChange*
  902. *:CtrlPChangeAll*
  903. * Change list mode:~
  904. - Name: 'changes'
  905. - Commands: ":CtrlPChange [buffer]",
  906. ":CtrlPChangeAll".
  907. - Search for and jump to a recent change in the current buffer or in all
  908. listed buffers.
  909. *:CtrlPMixed*
  910. * Mixed mode:~
  911. - Name: 'mixed'
  912. - Command: ":CtrlPMixed"
  913. - Search in files, buffers and MRU files at the same time.
  914. *:CtrlPBookmarkDir*
  915. *:CtrlPBookmarkDirAdd*
  916. * BookmarkDir mode:~
  917. - Name: 'bookmarkdir'
  918. - Commands: ":CtrlPBookmarkDir",
  919. ":CtrlPBookmarkDirAdd [directory]".
  920. - Search for a bookmarked directory and change the working directory to it.
  921. - Mappings:
  922. + <cr> change the local working directory for CtrlP, keep it open and
  923. switch to find file mode.
  924. + <c-x> change the global working directory (exit).
  925. + <c-v> change the local working directory for the current window (exit).
  926. + <F7>
  927. - Wipe bookmark list.
  928. - Delete entries marked by <c-z>.
  929. ----------------------------------------
  930. Buffer Tag mode options:~
  931. *'g:ctrlp_buftag_ctags_bin'*
  932. If ctags isn't in your $PATH, use this to set its location: >
  933. let g:ctrlp_buftag_ctags_bin = ''
  934. <
  935. *'g:ctrlp_buftag_systemenc'*
  936. Match this with your OS's encoding (not Vim's). The default value mirrors Vim's
  937. global |'encoding'| option: >
  938. let g:ctrlp_buftag_systemenc = &encoding
  939. <
  940. *'g:ctrlp_buftag_types'*
  941. Use this to set the arguments for ctags, jsctags... for a given filetype: >
  942. let g:ctrlp_buftag_types = ''
  943. <
  944. Examples: >
  945. let g:ctrlp_buftag_types = {
  946. \ 'erlang' : '--language-force=erlang --erlang-types=drmf',
  947. \ 'javascript' : {
  948. \ 'bin': 'jsctags',
  949. \ 'args': '-f -',
  950. \ },
  951. \ }
  952. <
  953. ===============================================================================
  954. CUSTOMIZATION *ctrlp-customization*
  955. Highlighting:~
  956. * For the CtrlP buffer:
  957. CtrlPNoEntries : the message when no match is found (Error)
  958. CtrlPMatch : the matched pattern (Identifier)
  959. CtrlPLinePre : the line prefix '>' in the match window
  960. CtrlPPrtBase : the prompt's base (Comment)
  961. CtrlPPrtText : the prompt's text (|hl-Normal|)
  962. CtrlPPrtCursor : the prompt's cursor when moving over the text (Constant)
  963. * In extensions:
  964. CtrlPTabExtra : the part of each line that's not matched against (Comment)
  965. CtrlPBufName : the buffer name an entry belongs to (|hl-Directory|)
  966. CtrlPTagKind : the kind of the tag in buffer-tag mode (|hl-Title|)
  967. CtrlPqfLineCol : the line and column numbers in quickfix mode (Comment)
  968. CtrlPUndoT : the elapsed time in undo mode (|hl-Directory|)
  969. CtrlPUndoBr : the square brackets [] in undo mode (Comment)
  970. CtrlPUndoNr : the undo number inside [] in undo mode (String)
  971. CtrlPUndoSv : the point where the file was saved (Comment)
  972. CtrlPUndoPo : the current position in the undo tree (|hl-Title|)
  973. CtrlPBookmark : the name of the bookmark (Identifier)
  974. Statuslines:~
  975. * Highlight groups:
  976. CtrlPMode1 : 'file' or 'path', and the current mode (Character)
  977. CtrlPMode2 : 'prt' or 'win', 'regex', the working directory (|hl-LineNr|)
  978. CtrlPStats : the scanning status (Function)
  979. For rebuilding the statuslines, see |g:ctrlp_status_func|.
  980. ===============================================================================
  981. MISCELLANEOUS CONFIGS *ctrlp-miscellaneous-configs*
  982. * Using |wildignore| for |g:ctrlp_user_command|:
  983. >
  984. function! s:wig2cmd()
  985. " Change wildignore into space or | separated groups
  986. " e.g. .aux .out .toc .jpg .bmp .gif
  987. " or .aux$\|.out$\|.toc$\|.jpg$\|.bmp$\|.gif$
  988. let pats = ['[*\/]*\([?_.0-9A-Za-z]\+\)\([*\/]*\)\(\\\@<!,\|$\)','\\\@<!,']
  989. let subs = has('win32') || has('win64') ? ['\1\3', ' '] : ['\1\2\3', '\\|']
  990. let expr = substitute(&wig, pats[0], subs[0], 'g')
  991. let expr = substitute(expr, pats[1], subs[1], 'g')
  992. let expr = substitute(expr, '\\,', ',', 'g')
  993. " Set the user_command option
  994. let g:ctrlp_user_command = has('win32') || has('win64')
  995. \ ? 'dir %s /-n /b /s /a-d | findstr /V /l "'.expr.'"'
  996. \ : 'find %s -type f | grep -v "'.expr .'"'
  997. endfunction
  998. call s:wig2cmd()
  999. <
  1000. (submitted by Rich Alesi <github.com/ralesi>)
  1001. * A standalone function to set the working directory to the project's root, or
  1002. to the parent directory of the current file if a root can't be found:
  1003. >
  1004. function! s:setcwd()
  1005. let cph = expand('%:p:h', 1)
  1006. if cph =~ '^.\+://' | retu | en
  1007. for mkr in ['.git/', '.hg/', '.svn/', '.bzr/', '_darcs/', '.vimprojects']
  1008. let wd = call('find'.(mkr =~ '/$' ? 'dir' : 'file'), [mkr, cph.';'])
  1009. if wd != '' | let &acd = 0 | brea | en
  1010. endfo
  1011. exe 'lc!' fnameescape(wd == '' ? cph : substitute(wd, mkr.'$', '.', ''))
  1012. endfunction
  1013. autocmd BufEnter * call s:setcwd()
  1014. <
  1015. (requires Vim 7.1.299+)
  1016. * Using a |count| to invoke different commands using the same mapping:
  1017. >
  1018. let g:ctrlp_cmd = 'exe "CtrlP".get(["", "Buffer", "MRU"], v:count)'
  1019. <
  1020. ===============================================================================
  1021. CREDITS *ctrlp-credits*
  1022. Developed by Kien Nguyen <github.com/kien>.
  1023. Project's homepage: http://kien.github.com/ctrlp.vim
  1024. Git repository: https://github.com/kien/ctrlp.vim
  1025. Mercurial repository: https://bitbucket.org/kien/ctrlp.vim
  1026. -------------------------------------------------------------------------------
  1027. Thanks to everyone that has submitted ideas, bug reports or helped debugging on
  1028. gibhub, bitbucket, and through email.
  1029. Special thanks:~
  1030. * Woojong Koh <github.com/wjkoh>
  1031. * Simon Ruderich
  1032. * Yasuhiro Matsumoto <github.com/mattn>
  1033. * Ken Earley <github.com/kenearley>
  1034. * Kyo Nagashima <github.com/hail2u>
  1035. * Zak Johnson <github.com/zakj>
  1036. * Diego Viola <github.com/diegoviola>
  1037. * Piet Delport <github.com/pjdelport>
  1038. * Thibault Duplessis <github.com/ornicar>
  1039. * Kent Sibilev <github.com/datanoise>
  1040. * Tacahiroy <github.com/tacahiroy>
  1041. * Luca Pette <github.com/lucapette>
  1042. * Seth Fowler <github.com/sfowler>
  1043. * Lowe Thiderman <github.com/thiderman>
  1044. * Christopher Fredén <github.com/icetan>
  1045. * Zahary Karadjov <github.com/zah>
  1046. * Jo De Boeck <github.com/grimpy>
  1047. ===============================================================================
  1048. CHANGELOG *ctrlp-changelog*
  1049. Before 2012/11/30~
  1050. + New options: |g:ctrlp_abbrev|,
  1051. |g:ctrlp_key_loop|,
  1052. |g:ctrlp_open_func|,
  1053. |g:ctrlp_tabpage_position|,
  1054. |g:ctrlp_mruf_save_on_update|
  1055. + Rename:
  1056. *g:ctrlp_dotfiles* -> |g:ctrlp_show_hidden|.
  1057. + Change |g:ctrlp_switch_buffer|'s and |g:ctrlp_working_path_mode|'s type
  1058. (old values still work).
  1059. + New key for |g:ctrlp_user_command| when it's a Dictionary: 'ignore'.
  1060. Before 2012/06/15~
  1061. + New value for |g:ctrlp_follow_symlinks|: 2.
  1062. + New value for |g:ctrlp_open_multiple_files|: 'j'.
  1063. + Allow using <c-t>, <c-x>, <c-v> to open files marked by <c-z>.
  1064. + Extend '..' (|ctrlp-input-formats| (d))
  1065. + New input format: '@cd' (|ctrlp-input-formats| (d))
  1066. Before 2012/04/30~
  1067. + New option: |g:ctrlp_mruf_default_order|
  1068. + New feature: Bookmarked directories extension.
  1069. + New commands: |:CtrlPBookmarkDir|
  1070. |:CtrlPBookmarkDirAdd|
  1071. Before 2012/04/15~
  1072. + New option: |g:ctrlp_buffer_func|, callback functions for CtrlP buffer.
  1073. + Remove: g:ctrlp_mruf_last_entered, make it a default for MRU mode.
  1074. + New commands: |:CtrlPLastMode|, open CtrlP in the last mode used.
  1075. |:CtrlPMixed|, search in files, buffers and MRU files.
  1076. Before 2012/03/31~
  1077. + New options: |g:ctrlp_default_input|, default input when entering CtrlP.
  1078. |g:ctrlp_match_func|, allow using a custom fuzzy matcher.
  1079. + Rename:
  1080. *ClearCtrlPCache* -> |CtrlPClearCache|
  1081. *ClearAllCtrlPCaches* -> |CtrlPClearAllCaches|
  1082. *ResetCtrlP* -> |CtrlPReload|
  1083. Before 2012/03/02~
  1084. + Rename:
  1085. *g:ctrlp_regexp_search* -> |g:ctrlp_regexp|,
  1086. *g:ctrlp_dont_split* -> |g:ctrlp_reuse_window|,
  1087. *g:ctrlp_jump_to_buffer* -> |g:ctrlp_switch_buffer|.
  1088. + Rename and tweak:
  1089. *g:ctrlp_open_multi* -> |g:ctrlp_open_multiple_files|.
  1090. + Deprecate *g:ctrlp_highlight_match*
  1091. + Extend |g:ctrlp_user_command| to support multiple commands.
  1092. + New option: |g:ctrlp_mruf_last_entered| change MRU to Recently-Entered.
  1093. Before 2012/01/15~
  1094. + New mapping: Switch <tab> and <s-tab>. <tab> is now used for completion
  1095. of directory names under the current working directory.
  1096. + New options: |g:ctrlp_arg_map| for <c-y>, <c-o> to accept an argument.
  1097. |g:ctrlp_status_func| custom statusline.
  1098. |g:ctrlp_mruf_relative| show only MRU files inside cwd.
  1099. + Extend g:ctrlp_open_multi with new optional values: tr, hr, vr.
  1100. + Extend |g:ctrlp_custom_ignore| to specifically filter dir, file and link.
  1101. Before 2012/01/05~
  1102. + New feature: Buffer Tag extension.
  1103. + New commands: |:CtrlPBufTag|, |:CtrlPBufTagAll|.
  1104. + New options: |g:ctrlp_cmd|,
  1105. |g:ctrlp_custom_ignore|
  1106. Before 2011/11/30~
  1107. + New features: Tag, Quickfix and Directory extensions.
  1108. + New commands: |:CtrlPTag|, |:CtrlPQuickfix|, |:CtrlPDir|.
  1109. + New options: |g:ctrlp_use_migemo|,
  1110. |g:ctrlp_lazy_update|,
  1111. |g:ctrlp_follow_symlinks|
  1112. Before 2011/11/13~
  1113. + New special input: '/' and '\' find root (|ctrlp-input-formats| (e))
  1114. + Remove ctrlp#SetWorkingPath().
  1115. + Remove *g:ctrlp_mru_files* and make MRU mode permanent.
  1116. + Extend g:ctrlp_open_multi, add new ways to open files.
  1117. + New option: g:ctrlp_dont_split,
  1118. |g:ctrlp_mruf_case_sensitive|
  1119. Before 2011/10/30~
  1120. + New feature: Support for custom extensions.
  1121. <F5> also removes non-existent files from MRU list.
  1122. + New option: g:ctrlp_jump_to_buffer
  1123. Before 2011/10/12~
  1124. + New features: Open multiple files.
  1125. Pass Vim's |++opt| and |+cmd| to the opening file
  1126. (|ctrlp-input-formats| (c))
  1127. Auto-complete each dir for |:CtrlP| [starting-directory]
  1128. + New mappings: <c-z> mark/unmark a file to be opened with <c-o>.
  1129. <c-o> open all marked files.
  1130. + New option: g:ctrlp_open_multi
  1131. + Remove *g:ctrlp_persistent_input* *g:ctrlp_live_update* and <c-^>.
  1132. Before 2011/09/29~
  1133. + New mappings: <c-n>, <c-p> next/prev string in the input history.
  1134. <c-y> create a new file and its parent dirs.
  1135. + New options: |g:ctrlp_open_new_file|,
  1136. |g:ctrlp_max_history|
  1137. + Added a new open-in-horizontal-split mapping: <c-x>
  1138. Before 2011/09/19~
  1139. + New command: ResetCtrlP
  1140. + New options: |g:ctrlp_max_files|,
  1141. |g:ctrlp_max_depth|,
  1142. g:ctrlp_live_update
  1143. + New mapping: <c-^>
  1144. Before 2011/09/12~
  1145. + Ability to cycle through matched lines in the match window.
  1146. + Extend the behavior of g:ctrlp_persistent_input
  1147. + Extend the behavior of |:CtrlP|
  1148. + New options: |g:ctrlp_dotfiles|,
  1149. |g:ctrlp_clear_cache_on_exit|,
  1150. g:ctrlp_highlight_match,
  1151. |g:ctrlp_user_command|
  1152. + New special input: '..' (|ctrlp-input-formats| (d))
  1153. + New mapping: <F5>.
  1154. + New commands: |:CtrlPCurWD|,
  1155. |:CtrlPCurFile|,
  1156. |:CtrlPRoot|
  1157. + New feature: Search in most recently used (MRU) files
  1158. + New mapping: <c-b>.
  1159. + Extended the behavior of <c-f>.
  1160. + New options: g:ctrlp_mru_files,
  1161. |g:ctrlp_mruf_max|,
  1162. |g:ctrlp_mruf_exclude|,
  1163. |g:ctrlp_mruf_include|
  1164. + New command: |:CtrlPMRU|
  1165. First public release: 2011/09/06~
  1166. ===============================================================================
  1167. vim:ft=help:et:ts=2:sw=2:sts=2:norl