ctrlp.vim/doc/ctrlp.txt
2012-03-12 08:58:01 +07:00

970 lines
37 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

*ctrlp.txt* Fuzzy file, buffer, mru and tag finder. v1.7.2
*CtrlP* *ControlP* *'ctrlp'* *'ctrl-p'*
===============================================================================
# #
# :::::::: ::::::::::: ::::::::: ::: ::::::::: #
# :+: :+: :+: :+: :+: :+: :+: :+: #
# +:+ +:+ +:+ +:+ +:+ +:+ +:+ #
# +#+ +#+ +#++:++#: +#+ +#++:++#+ #
# +#+ +#+ +#+ +#+ +#+ +#+ #
# #+# #+# #+# #+# #+# #+# #+# #
# ######## ### ### ### ########## ### #
# #
===============================================================================
CONTENTS *ctrlp-contents*
1. Intro........................................|ctrlp-intro|
2. Options......................................|ctrlp-options|
3. Commands.....................................|ctrlp-commands|
4. Mappings.....................................|ctrlp-mappings|
5. Input Formats................................|ctrlp-input-formats|
6. Extensions...................................|ctrlp-extensions|
===============================================================================
INTRO *ctrlp-intro*
Full path fuzzy file, buffer, mru and tag finder with an intuitive interface.
Written in pure Vimscript for MacVim and Vim version 7.0+. Has full support for
Vims |regexp| as search pattern, built-in MRU files monitoring, projects root
finder, and more.
To enable optional extensions (tag, dir, rtscript...), see |ctrlp-extensions|.
===============================================================================
OPTIONS *ctrlp-options*
Below are the available options and their default values:~
*'g:ctrlp_map'*
Use this option to change the mapping to invoke |CtrlP| in |Normal| mode: >
let g:ctrlp_map = '<c-p>'
<
*'g:ctrlp_cmd'*
Set the default opening command to use when pressing the above mapping: >
let g:ctrlp_cmd = 'CtrlP'
<
*'g:loaded_ctrlp'*
Use this to disable the plugin completely: >
let g:loaded_ctrlp = 1
<
*'g:ctrlp_by_filename'*
Set this to 1 to set searching by filename (not full path) as the default: >
let g:ctrlp_by_filename = 0
<
Can be toggled on/off by pressing <c-d> inside the prompt.
*'g:ctrlp_regexp'*
Set this to 1 to set |regexp| search as the default: >
let g:ctrlp_regexp = 0
<
Can be toggled on/off by pressing <c-r> inside the prompt.
*'g:ctrlp_match_window_bottom'*
Set this to 0 to show the match window at the top of the screen: >
let g:ctrlp_match_window_bottom = 1
<
*'g:ctrlp_match_window_reversed'*
Change the listing order of the files in the match window. The default setting
(1) is from bottom to top: >
let g:ctrlp_match_window_reversed = 1
<
*'g:ctrlp_max_height'*
Set the maximum height of the match window: >
let g:ctrlp_max_height = 10
<
*'g:ctrlp_switch_buffer'*
When opening a file with <cr> or <c-t>, if the files already opened somewhere
|CtrlP| will try to jump to it instead of opening a new instance: >
let g:ctrlp_switch_buffer = 2
<
1 - only jump to the buffer if its opened in the current tab.
2 - jump tab as well if the buffers opened in another tab.
0 - disable this feature.
*'g:ctrlp_reuse_window'*
When opening a file with <cr>, |CtrlP| avoids opening it in windows created by
plugins, help and quickfix. Use this to setup some exceptions: >
let g:ctrlp_reuse_window = 'netrw'
<
Acceptable values are partial name, filetype or buftype of the special buffers.
Use |regexp| to specify the pattern.
Example: >
let g:ctrlp_reuse_window = 'netrw\|help\|quickfix'
<
*'g:ctrlp_working_path_mode'*
When starting up, |CtrlP| sets its local working directory according to this
variable: >
let g:ctrlp_working_path_mode = 2
<
1 - the parent directory of the current file.
2 - the nearest ancestor that contains one of these directories or files:
.git/ .hg/ .svn/ .bzr/ _darcs/
0 - dont manage working directory.
Note: you can use b:ctrlp_working_path_mode (a |b:var|) to set this option on a
per buffer basis.
*'g:ctrlp_root_markers'*
Use this to set your own root markers in addition to the default ones. Your
markers will take precedence: >
let g:ctrlp_root_markers = ['']
<
These markers (builtins and yours) will serve as identifiers for the '/' and
'\' special inputs (|ctrlp-input-formats| (e)).
*'g:ctrlp_use_caching'*
Set this to 0 to disable per-session caching. When disabled, caching will still
be enabled for directories that have more than 4000 files: >
let g:ctrlp_use_caching = 1
<
Note: you can quickly purge the cache by pressing <F5> while inside |CtrlP|.
*'g:ctrlp_clear_cache_on_exit'*
Set this to 0 to enable cross-session caching by not deleting the cache files
upon exiting Vim: >
let g:ctrlp_clear_cache_on_exit = 1
<
*'g:ctrlp_cache_dir'*
Set the directory to store the cache files: >
let g:ctrlp_cache_dir = $HOME.'/.cache/ctrlp'
<
*'g:ctrlp_prompt_mappings'*
Use this to customize the mappings inside |CtrlP|s prompt to your liking. You
only need to keep the lines that youve changed the values (inside []): >
let g:ctrlp_prompt_mappings = {
\ 'PrtBS()': ['<bs>', '<c-]>'],
\ 'PrtDelete()': ['<del>'],
\ 'PrtDeleteWord()': ['<c-w>'],
\ 'PrtClear()': ['<c-u>'],
\ 'PrtSelectMove("j")': ['<c-j>', '<down>'],
\ 'PrtSelectMove("k")': ['<c-k>', '<up>'],
\ 'PrtHistory(-1)': ['<c-n>'],
\ 'PrtHistory(1)': ['<c-p>'],
\ 'AcceptSelection("e")': ['<cr>', '<2-LeftMouse>'],
\ 'AcceptSelection("h")': ['<c-x>', '<c-cr>', '<c-s>'],
\ 'AcceptSelection("t")': ['<c-t>', '<MiddleMouse>'],
\ 'AcceptSelection("v")': ['<c-v>', '<RightMouse>'],
\ 'ToggleFocus()': ['<s-tab>'],
\ 'ToggleRegex()': ['<c-r>'],
\ 'ToggleByFname()': ['<c-d>'],
\ 'ToggleType(1)': ['<c-f>', '<c-up>'],
\ 'ToggleType(-1)': ['<c-b>', '<c-down>'],
\ 'PrtExpandDir()': ['<tab>'],
\ 'PrtInsert("w")': ['<F2>', '<insert>'],
\ 'PrtInsert("s")': ['<F3>'],
\ 'PrtInsert("v")': ['<F4>'],
\ 'PrtInsert("+")': ['<F6>'],
\ 'PrtCurStart()': ['<c-a>'],
\ 'PrtCurEnd()': ['<c-e>'],
\ 'PrtCurLeft()': ['<c-h>', '<left>', '<c-^>'],
\ 'PrtCurRight()': ['<c-l>', '<right>'],
\ 'PrtClearCache()': ['<F5>'],
\ 'PrtDeleteMRU()': ['<F7>'],
\ 'CreateNewFile()': ['<c-y>'],
\ 'MarkToOpen()': ['<c-z>'],
\ 'OpenMulti()': ['<c-o>'],
\ 'PrtExit()': ['<esc>', '<c-c>', '<c-g>'],
\ }
<
Note: In some terminals, its not possible to remap <c-h> without also changing
<bs> (|key-codes|). So if pressing <bs> moves the cursor to the left instead of
deleting a char for you, add this to your |vimrc| to disable the default <c-h>
mapping: >
let g:ctrlp_prompt_mappings = { 'PrtCurLeft()': ['<left>', '<c-^>'] }
<
*'g:ctrlp_mruf_max'*
Specify the number of recently opened files you want |CtrlP| to remember: >
let g:ctrlp_mruf_max = 250
<
*'g:ctrlp_mruf_exclude'*
Files you dont want |CtrlP| to remember. Use |regexp| to specify the patterns:
>
let g:ctrlp_mruf_exclude = ''
<
Examples: >
let g:ctrlp_mruf_exclude = '/tmp/.*\|/temp/.*' " MacOSX/Linux
let g:ctrlp_mruf_exclude = '^C:\\dev\\tmp\\.*' " Windows
<
*'g:ctrlp_mruf_include'*
And if you want |CtrlP| to only remember some files, specify them here: >
let g:ctrlp_mruf_include = ''
<
Example: >
let g:ctrlp_mruf_include = '\.py$\|\.rb$'
<
*'g:ctrlp_mruf_relative'*
Set this to 1 to show only MRU files in the current working directory: >
let g:ctrlp_mruf_relative = 0
<
*'g:ctrlp_mruf_case_sensitive'*
Match this with your file system case-sensitivity setting to avoid duplicate
MRU entries: >
let g:ctrlp_mruf_case_sensitive = 1
<
*'g:ctrlp_mruf_last_entered'*
Set to 1 to sort the MRU file list to most-recently-entered-buffer order: >
let g:ctrlp_mruf_last_entered = 0
<
*'g:ctrlp_dotfiles'*
Set this to 0 if you dont want |CtrlP| to scan for dotfiles and dotdirs: >
let g:ctrlp_dotfiles = 1
<
You can use |'wildignore'| to exclude anything from the search.
Examples: >
" Excluding version control directories
set wildignore+=*/.git/*,*/.hg/*,*/.svn/* " Linux/MacOSX
set wildignore+=.git\*,.hg\*,.svn\* " Windows
<
Note #1: the `*/` in front of each directory glob is required.
Note #2: |wildignore| influences the result of |expand()|, |globpath()| and
|glob()| which many plugins use to find stuff on the system (e.g. VCS related
plugins look for .git/, .hg/,... some other plugins look for external *.exe
tools on Windows). So be a little mindful of what you put in your |wildignore|.
*'g:ctrlp_custom_ignore'*
In addition to |'wildignore'|, use this for files and directories you want only
|CtrlP| to not show. Use |regexp| to specify the patterns: >
let g:ctrlp_custom_ignore = ''
<
Examples: >
let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$'
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git$\|\.hg$\|\.svn$',
\ 'file': '\.exe$\|\.so$\|\.dll$',
\ 'link': 'SOME_BAD_SYMBOLIC_LINKS',
\ }
<
*'g:ctrlp_max_files'*
The maximum number of files to scan, set to 0 for no limit: >
let g:ctrlp_max_files = 10000
<
*'g:ctrlp_max_depth'*
The maximum depth of a directory tree to recurse into: >
let g:ctrlp_max_depth = 40
<
Note: the larger these values, the more memory Vim uses.
*'g:ctrlp_user_command'*
Specify an external tool to use for listing files instead of using Vims
|globpath()|. Use %s in place of the target directory: >
let g:ctrlp_user_command = ''
<
Examples: >
let g:ctrlp_user_command = 'find %s -type f' " MacOSX/Linux
let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d' " Windows
<
You can also use 'grep', 'findstr' or something else to filter the results.
Examples: >
let g:ctrlp_user_command = 'find %s -type f | grep (?!tmp/.*)'
let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d | findstr .*\.py$'
<
Use a version control listing command when inside a repository, this is faster
when scanning large projects: >
let g:ctrlp_user_command = [root_marker, listing_command, fallback_command]
let g:ctrlp_user_command = {
\ 'types': {
\ 1: [root_marker_1, listing_command_1],
\ n: [root_marker_n, listing_command_n],
\ },
\ 'fallback': fallback_command
\ }
<
Examples: >
let g:ctrlp_user_command = ['.git/', 'cd %s && git ls-files']
let g:ctrlp_user_command = ['.hg/', 'hg --cwd %s locate -I .']
let g:ctrlp_user_command = {
\ 'types': {
\ 1: ['.git/', 'cd %s && git ls-files'],
\ 2: ['.hg/', 'hg --cwd %s locate -I .'],
\ },
\ 'fallback': 'find %s -type f'
\ }
<
If the fallback_command is empty or not defined, |globpath()| will then be used
when searching outside a repo.
*'g:ctrlp_max_history'*
The maximum number of input strings you want |CtrlP| to remember. The default
value mirrors Vims global |'history'| option: >
let g:ctrlp_max_history = &history
<
Set to 0 to disable prompts history. Browse the history with <c-n> and <c-p>.
*'g:ctrlp_open_new_file'*
Use this option to specify how the newly created file is to be opened when
pressing <c-y>:
t - in a new tab
h - in a new horizontal split
v - in a new vertical split
r - in the current window
>
let g:ctrlp_open_new_file = 'v'
<
*'g:ctrlp_open_multiple_files'*
If non-zero, this will enable opening multiple files with <c-z> and <c-o>: >
let g:ctrlp_open_multiple_files = 'v'
<
Example: >
let g:ctrlp_open_multiple_files = '2vr'
<
For the number:
- If given, itll be used as the maximum number of windows or tabs to create
when opening the files (the rest will be opened as hidden buffers).
- If not given, <c-o> will open all files, each in a new window or new tab.
For the letters:
t - each file in a new tab.
h - each file in a new horizontal split.
v - each file in a new vertical split.
Reuse the current window:
tr,
hr,
vr - open the first file in the current window, then the remaining files in
new splits or new tabs just like with t, h, v.
*'g:ctrlp_arg_map'*
When this is set to 1, the <c-o> and <c-y> mappings will accept one extra key
as an argument to override their default behavior: >
let g:ctrlp_arg_map = 0
<
Pressing <c-o> or <c-y> will then prompt for a keypress. The key can be:
t - open in tab(s)
h - open in horizontal split(s)
v - open in vertical split(s)
r - open in current window (for <c-y> only)
<esc>, <c-c> - cancel and go back to the prompt.
Any other key - use the behavior specified with |g:ctrlp_open_new_file| and
|g:ctrlp_open_multiple_files|.
*'g:ctrlp_follow_symlinks'*
Set this to 1 to follow symbolic links when listing files: >
let g:ctrlp_follow_symlinks = 0
<
When enabled, looped internal symlinks will be ignored to avoid duplicates.
*'g:ctrlp_lazy_update'*
Set this to 1 to enable the lazy-update feature: only update the match window
after typings been stopped for a certain amount of time: >
let g:ctrlp_lazy_update = 0
<
If is 1, update after 250ms. If bigger than 1, the number will be used as the
delay time in milliseconds.
*'g:ctrlp_use_migemo'*
Set this to 1 to use Migemo Pattern for Japanese filenames. Migemo Search only
works in |regexp| mode. To split the pattern, separate words with space: >
let g:ctrlp_use_migemo = 0
<
*'g:ctrlp_status_func'*
Use this to customize the statuslines for the |CtrlP| window: >
let g:ctrlp_status_func = {}
<
Example: >
let g:ctrlp_status_func = {
\ 'main': 'Function_Name_1',
\ 'prog': 'Function_Name_2',
\ }
<
Structure of the functions: >
function! Function_Name_1(focus, byfname, regex, prev, item, next, marked)
" a:focus a:byfname a:regex a:prev a:item a:next a:marked
" | | | | | | |
" | | | | | | +- Number of marked files.
" | | | | | |
" | | | | | +- The next search mode.
" | | | | |
" | | | | +- The current search mode.
" | | | |
" | | | +- The previous search mode.
" | | |
" | | +- In regex mode: 1 or 0.
" | |
" | +- In filename mode or in full path mode: "file" or "path".
" |
" +- The focus of the prompt: "prt" or "win".
return full_statusline
endfunction
function! Function_Name_2(str)
" a:str
" |
" + Either a number of files scanned so far, or a string indicating the
" directory is being scanned with a user_command.
return full_statusline
endfunction
<
See https://gist.github.com/1610859 for a working example.
*'g:ctrlp_match_func'*
Set an external fuzzy matching function for |CtrlP| to use: >
let g:ctrlp_match_func = {}
<
Example: >
let g:ctrlp_match_func = { 'match': 'Function_Name' }
<
Structure of the function: >
function! Function_Name(items, str, limit, mmode, ispath, crfile, regex)
" a:items a:str a:limit a:mmode a:ispath a:crfile a:regex
" | | | | | | |
" | | | | | | +- In regex mode: 1 or 0.
" | | | | | |
" | | | | | +- The file in the current window
" | | | | | Should be excluded from the
" | | | | | results when a:ispath == 1.
" | | | | |
" | | | | +- Is 1 when searching in file, buffer, mru
" | | | | dir, rtscript... modes. Is 0 otherwise.
" | | | |
" | | | +- The match mode. Can be one of these strings:
" | | | + "full-line": match the entire line.
" | | | + "filename-only": match only the filename.
" | | | + "first-non-tab": match until the first tab char.
" | | | + "until-last-tab": match until the last tab char.
" | | |
" | | +- The max height of the match window. Can be used to limit
" | | the number of items to return.
" | |
" | +- The string entered by the user.
" |
" +- The full list of items to search in (e.g. all files in a dir tree).
return list_of_matched_items
endfunction
<
===============================================================================
COMMANDS *ctrlp-commands*
*:CtrlP*
:CtrlP [starting-directory]
Open |CtrlP| in find file mode.
If no argument is given, the value of |g:ctrlp_working_path_mode| will be
used to determine the starting directory.
You can use <tab> to auto-complete the [starting-directory] when typing it.
*:CtrlPBuffer*
:CtrlPBuffer
Open |CtrlP| in find buffer mode.
*:CtrlPMRU*
:CtrlPMRU
Open |CtrlP| in find Most-Recently-Used file mode.
*:CtrlPClearCache*
:CtrlPClearCache
Flush the cache for the current working directory. The same as pressing <F5>
inside |CtrlP|.
You can also enable/disable caching with the option |g:ctrlp_use_caching|.
*:CtrlPClearAllCaches*
:CtrlPClearAllCaches
Delete all the cache files saved in |g:ctrlp_cache_dir|.
*:CtrlPReload*
:CtrlPReload
Load new values for the option variables.
-------------------------------------------------------------------------------
The following commands ignore the current value of |g:ctrlp_working_path_mode|:
:CtrlPCurWD *:CtrlPCurWD*
This acts like |:CtrlP| with |path_mode| = 0
:CtrlPCurFile *:CtrlPCurFile*
This acts like |:CtrlP| with |path_mode| = 1
:CtrlPRoot *:CtrlPRoot*
This acts like |:CtrlP| with |path_mode| = 2
===============================================================================
MAPPINGS *ctrlp-mappings*
*'ctrlp-<c-p>'*
<c-p>
Default |Normal| mode mapping to open the |CtrlP| prompt in find file mode.
Once inside the prompt:~
<c-r> *'ctrlp-fullregexp'*
Toggle between the string mode and full |regexp| mode.
Note: in full |regexp| mode, the prompts base is 'r>>' instead of '>>>'
See also |input-formats| (guide) and |g:ctrlp_regexp_search| (option).
<c-d>
Toggle between full-path search and filename only search.
Note: in filename mode, the prompts base is '>d>' instead of '>>>'
<c-f>, 'forward'
<c-up>
Scroll to the 'next' search mode in the sequence.
<c-b>, 'backward'
<c-down>
Scroll to the 'previous' search mode in the sequence.
<tab>
Auto-complete directory names under the current working directory inside
the prompt.
<s-tab>
Toggle the focus between the match window and the prompt.
<c-j>,
<down>
Move selection down.
<c-k>,
<up>
Move selection up.
<c-a>
Move the cursor to the 'start' of the prompt.
<c-e>
Move the cursor to the 'end' of the prompt.
<c-h>,
<left>,
<c-^>
Move the cursor one character to the 'left'.
<c-l>,
<right>
Move the cursor one character to the 'right'.
<c-]>,
<bs>
Delete the preceding character.
<del>
Delete the current character.
<c-w>
Delete a preceding inner word.
<c-u>
Clear the input field.
<cr>
Open selected file in the active window if possible.
<c-t>
Open selected file in a new 'tab' after the last tabpage.
<c-v>
Open selected file in a 'vertical' split.
<c-cr>,
<c-s>,
<c-x>
Open selected file in a 'horizontal' split.
<c-y>
Create a new file and its parent directories.
<c-n>
Next string in the prompts history.
<c-p>
Previous string in the prompts history.
<c-z>
- Mark/unmark a file to be opened with <c-o>.
- Mark/unmark a file to create a new file in its directory using <c-y>.
<c-o>
Open files marked by <c-z>.
<F5>
- Refresh the match window and purge the cache for the current directory.
- Remove deleted files from MRU list.
<F7>
- Wipe MRU list.
- Delete MRU entries marked by <c-z>.
<insert>
Insert the word under the cursor (in the active buffer) into the prompt.
<esc>,
<c-c>,
<c-g>
Exit |CtrlP|.
Note: <c-c> can also be used to stop the scan if its taking too long.
Choose your own mappings with |g:ctrlp_prompt_mappings|.
When inside the match window (press <s-tab> to switch):~
a-z
0-9
~^-=;`',.+!@#$%&_(){}[]
Cycle through the lines with the first letter (of paths or filenames) that
matches that key.
===============================================================================
INPUT FORMATS *ctrlp-input-formats*
Formats for inputting in the prompt:~
a) Simple string.
e.g. 'abc' is understood internally as 'a[^a]\{-}b[^b]\{-}c'
b) Vim |regexp|. If the input string contains '*' or '|', itll be treated as
a Vims |regexp| |pattern| without any modification.
e.g. 'abc\d*efg' will be read as 'abc\d*efg'.
See also |ctrlp-fullregexp| (keymap) and |g:ctrlp_regexp_search| (option).
c) End the string with a colon ':' followed by a Vim command to execute that
command after opening the file. If you need to use ':' literally, escape it
with a backslash: '\:'. When opening multiple files, the command will be
executed on each opening file.
e.g. 'abc:45' will open the selected file and jump to line 45.
'abc:/my\:string' will open the selected file and jump to the first
instance of 'my:function'.
'abc:+setf\ myfiletype|50' will open the selected file and set its
filetype to 'myfiletype', then jump to line 50.
'abc:diffthis' will open the selected file and run |:diffthis| on the
first 4 files.
See also Vims |++opt| and |+cmd|.
d) Type exactly two dots '..' at the start of the prompt and press enter to go
backward in the directory tree by 1 level. If the parent directory is
large, this might be slow.
e) Similarly, submit '/' or '\' to find and go to the projects root. If the
project is large, using a VCS listing command to look for files might help
speeding up the intial scan (see |g:ctrlp_user_command| for more details).
f) Type the name of a non-existent file and press <c-y> to create it. Mark a
file with <c-z> to create the new file in the same directory as the marked
file.
e.g. 'parentdir/newfile.txt' will create a directory named 'parentdir' as
well as 'newfile.txt'.
If 'some/old/dirs/oldfile.txt' is marked with <c-z>, then 'parentdir'
and 'newfile.txt' will be created in 'some/old/dirs'. The final path
will then be 'some/old/dirs/parentdir/newfile.txt'.
Use '\' in place of '/' on Windows (if |'ssl'| is not set).
g) Submit ? to open this help file.
===============================================================================
EXTENSIONS *g:ctrlp-extensions*
Extensions are optional. To enable an extension, add its name to the variable
g:ctrlp_extensions: >
let g:ctrlp_extensions = ['tag', 'buffertag', 'quickfix', 'dir', 'rtscript']
<
The order of the items will be the order they appear on the statusline and when
using <c-f>, <c-b>.
Available extensions:~
*:CtrlPTag*
* Tag mode:~
- Name: 'tag'
- Command: ':CtrlPTag'
- Search for a tag within a generated central tags file, and jump to the
definition. Use the Vims option |'tags'| to specify the names and the
locations of the tags file(s). Example: `set tags+=tags/help,doc/tags`
*:CtrlPBufTag*
*:CtrlPBufTagAll*
* Buffer Tag mode:~
- Name: 'buffertag'
- Commands: ':CtrlPBufTag [buffer-name]',
':CtrlPBufTagAll'.
- Search for a tag within the current buffer or all buffers and jump to the
definition. Requires |exuberant_ctags| or compatible programs.
*:CtrlPQuickfix*
* Quickfix mode:~
- Name: 'quickfix'
- Command: ':CtrlPQuickfix'
- Search for an entry in the current quickfix errors and jump to it.
*:CtrlPDir*
* Directory mode:~
- Name: 'dir'
- Command: ':CtrlPDir [starting-directory]'
- Search for a directory and change the working directory to it.
- Mappings:
+ <cr> change the local working directory for |CtrlP| and keep it open.
+ <c-t> change the global working directory (exit).
+ <c-v> change the local working directory for the current window (exit).
+ <c-x> change the global working directory to |CtrlP|s current local
working directory (exit).
*:CtrlPRTS*
* Runtime script mode:~
- Name: 'rtscript'
- Command: ':CtrlPRTS'
- Search for files (vimscripts, docs, snippets...) in runtimepath.
-------------------------------------------------------------------------------
Buffer Tag mode options:~
*'g:ctrlp_buftag_ctags_bin'*
If ctags isnt in your $PATH, use this to set its location: >
let g:ctrlp_buftag_ctags_bin = ''
<
*'g:ctrlp_buftag_systemenc'*
Match this with your OSs encoding (not Vims). The default value mirrors Vims
global |'encoding'| option: >
let g:ctrlp_buftag_systemenc = &encoding
<
*'g:ctrlp_buftag_types'*
Use this to set the arguments for ctags, jsctags... for a given filetype: >
let g:ctrlp_buftag_types = ''
<
Examples: >
let g:ctrlp_buftag_types = {
\ 'erlang' : '--language-force=erlang --erlang-types=drmf',
\ 'javascript' : {
\ 'bin': 'jsctags',
\ 'args': '-f -',
\ },
\ }
<
===============================================================================
CUSTOMIZATION *ctrlp-customization*
Highlighting:~
* For the |CtrlP| buffer:
CtrlPNoEntries : the message when no match is found (Error)
CtrlPMatch : the matched pattern (Identifier)
CtrlPLinePre : the line prefix '>' in the match window
CtrlPPrtBase : the prompts base (Comment)
CtrlPPrtText : the prompts text (|hl-Normal|)
CtrlPPrtCursor : the prompts cursor when moving over the text (Constant)
* In extensions:
CtrlPTabExtra : the part of each line thats not matched against (Comment)
CtrlPqfLineCol : the line and column numbers in quickfix mode (|hl-Search|)
CtrlPUndoT : the elapsed time in undo mode (|hl-Directory|)
CtrlPUndoBr : the square brackets [] in undo mode (Comment)
CtrlPUndoNr : the undo number inside [] in undo mode (String)
Statuslines:~
* Highlight groups:
CtrlPMode1 : 'prt' or 'win', also for 'regex' (Character)
CtrlPMode2 : 'file' or 'path', also for the local working dir (|hl-LineNr|)
CtrlPStats : the scanning status (Function)
For rebuilding the statuslines, see |g:ctrlp_status_func|.
===============================================================================
MISCELLANEOUS CONFIGS *ctrlp-miscellaneous-configs*
* Use |wildignore| for |g:ctrlp_user_command|:
>
function! s:wig2cmd()
" Change wildignore into space or | separated groups
" e.g. .aux .out .toc .jpg .bmp .gif
" or .aux$\|.out$\|.toc$\|.jpg$\|.bmp$\|.gif$
let pats = ['[*\/]*\([?_.0-9A-Za-z]\+\)\([*\/]*\)\(\\\@<!,\|$\)','\\\@<!,']
let subs = has('win32') || has('win64') ? ['\1\3', ' '] : ['\1\2\3', '\\|']
let expr = substitute(&wig, pats[0], subs[0], 'g')
let expr = substitute(expr, pats[1], subs[1], 'g')
let expr = substitute(expr, '\\,', ',', 'g')
" Set the user_command option
let g:ctrlp_user_command = has('win32') || has('win64')
\ ? 'dir %s /-n /b /s /a-d | findstr /V /l "'.expr.'"'
\ : 'find %s -type f | grep -v "'.expr .'"'
endfunction
call s:wig2cmd()
<
(submitted by Rich Alesi <github.com/ralesi>)
* A standalone function to set the working directory to the projects root, or
to the parent directory of the current file if a root cant be found:
>
function! s:setcwd()
let cph = expand('%:p:h', 1)
if match(cph, '\v^<.+>://') >= 0 | retu | en
for mkr in ['.git/', '.hg/', '.svn/', '.bzr/', '_darcs/', '.vimprojects']
let wd = call('find'.(mkr =~ '/$' ? 'dir' : 'file'), [mkr, cph.';'])
if wd != '' | let &acd = 0 | brea | en
endfo
exe 'lc!' fnameescape(wd == '' ? cph : substitute(wd, mkr.'$', '.', ''))
endfunction
autocmd BufEnter * call s:setcwd()
<
(requires Vim 7.1.299+)
===============================================================================
CREDITS *ctrlp-credits*
Developed by Kien Nguyen <github.com/kien>.
Projects homepage: http://kien.github.com/ctrlp.vim
Git repository: https://github.com/kien/ctrlp.vim
Mercurial repository: https://bitbucket.org/kien/ctrlp.vim
-------------------------------------------------------------------------------
Thanks to everyone that has submitted ideas, bug reports or helped debugging on
gibhub, bitbucket, and through email.
Special thanks:~
* Woojong Koh <github.com/wjkoh>
* Simon Ruderich
* Yasuhiro Matsumoto <github.com/mattn>
* Ken Earley <github.com/kenearley>
* Kyo Nagashima <github.com/hail2u>
* Zak Johnson <github.com/zakj>
* Diego Viola <github.com/diegoviola>
* Piet Delport <github.com/pjdelport>
* Thibault Duplessis <github.com/ornicar>
* Kent Sibilev <github.com/datanoise>
* Tacahiroy <github.com/tacahiroy>
* Luca Pette <github.com/lucapette>
===============================================================================
CHANGELOG *ctrlp-changelog*
+ New option: |g:ctrlp_match_func|, allow using a custom fuzzy matcher.
+ Rename:
*ClearCtrlPCache* -> |CtrlPClearCache|
*ClearAllCtrlPCaches* -> |CtrlPClearAllCaches|
*ResetCtrlP* -> |CtrlPReload|
Before 2012/03/02~
+ Rename:
*g:ctrlp_regexp_search* -> |g:ctrlp_regexp|,
*g:ctrlp_dont_split* -> |g:ctrlp_reuse_window|,
*g:ctrlp_jump_to_buffer* -> |g:ctrlp_switch_buffer|.
+ Rename and tweak:
*g:ctrlp_open_multi* -> |g:ctrlp_open_multiple_files|.
+ Deprecate *g:ctrlp_highlight_match*
+ Extend |g:ctrlp_user_command| to support multiple commands.
+ New option: |g:ctrlp_mruf_last_entered| change MRU to Recently-Entered.
Before 2012/01/15~
+ New mapping: Switch <tab> and <s-tab>. <tab> is now used for completion
of directory names under the current working directory.
+ New options: |g:ctrlp_arg_map| for <c-y>, <c-o> to accept an argument.
|g:ctrlp_status_func| custom statusline.
|g:ctrlp_mruf_relative| show only MRU files inside cwd.
+ Extend g:ctrlp_open_multi with new optional values: tr, hr, vr.
+ Extend |g:ctrlp_custom_ignore| to specifically filter dir, file and link.
Before 2012/01/05~
+ New feature: Buffer Tag extension.
+ New commands: |:CtrlPBufTag|, |:CtrlPBufTagAll|.
+ New options: |g:ctrlp_cmd|,
|g:ctrlp_custom_ignore|
Before 2011/11/30~
+ New features: Tag, Quickfix and Directory extensions.
+ New commands: |:CtrlPTag|, |:CtrlPQuickfix|, |:CtrlPDir|.
+ New options: |g:ctrlp_use_migemo|,
|g:ctrlp_lazy_update|,
|g:ctrlp_follow_symlinks|
Before 2011/11/13~
+ New special input: '/' and '\' find root (|ctrlp-input-formats| (e))
+ Remove ctrlp#SetWorkingPath().
+ Remove *g:ctrlp_mru_files* and make MRU mode permanent.
+ Extend g:ctrlp_open_multi, add new ways to open files.
+ New option: g:ctrlp_dont_split,
|g:ctrlp_mruf_case_sensitive|
Before 2011/10/30~
+ New feature: Support for custom extensions.
<F5> also removes non-existent files from MRU list.
+ New option: g:ctrlp_jump_to_buffer
Before 2011/10/12~
+ New features: Open multiple files.
Pass Vims |++opt| and |+cmd| to the opening file
(|ctrlp-input-formats| (c))
Auto-complete each dir for |:CtrlP| [starting-directory]
+ New mappings: <c-z> mark/unmark a file to be opened with <c-o>.
<c-o> open all marked files.
+ New option: g:ctrlp_open_multi
+ Remove *g:ctrlp_persistent_input* *g:ctrlp_live_update* and <c-^>.
Before 2011/09/29~
+ New mappings: <c-n>, <c-p> next/prev string in the input history.
<c-y> create a new file and its parent dirs.
+ New options: |g:ctrlp_open_new_file|,
|g:ctrlp_max_history|
+ Added a new open-in-horizontal-split mapping: <c-x>
Before 2011/09/19~
+ New command: ResetCtrlP
+ New options: |g:ctrlp_max_files|,
|g:ctrlp_max_depth|,
g:ctrlp_live_update
+ New mapping: <c-^>
Before 2011/09/12~
+ Ability to cycle through matched lines in the match window.
+ Extend the behavior of g:ctrlp_persistent_input
+ Extend the behavior of |:CtrlP|
+ New options: |g:ctrlp_dotfiles|,
|g:ctrlp_clear_cache_on_exit|,
g:ctrlp_highlight_match,
|g:ctrlp_user_command|
+ New special input: '..' (|ctrlp-input-formats| (d))
+ New mapping: <F5>.
+ New commands: |:CtrlPCurWD|,
|:CtrlPCurFile|,
|:CtrlPRoot|
+ New feature: Search in most recently used (MRU) files
+ New mapping: <c-b>.
+ Extended the behavior of <c-f>.
+ New options: g:ctrlp_mru_files,
|g:ctrlp_mruf_max|,
|g:ctrlp_mruf_exclude|,
|g:ctrlp_mruf_include|
+ New command: |:CtrlPMRU|
First public release: 2011/09/06~
===============================================================================
vim:ft=help:et:ts=2:sw=2:sts=2:norl