1
0
mirror of https://github.com/amix/vimrc synced 2025-06-30 20:05:01 +08:00

Updated all plugins that are non-forked. Added some new plugins.

Added update_plugins.py which can fetch new plugins from GitHub.

New plugins added: zencoding, vim-indent-object, taglist, nginx.vim
This commit is contained in:
amix
2013-04-13 14:45:21 -03:00
parent 5731b3a420
commit 3f1cdba799
1057 changed files with 33631 additions and 10806 deletions

File diff suppressed because it is too large Load Diff

View File

@ -149,13 +149,16 @@ fu! s:esctagscmd(bin, args, ...)
if exists('+ssl')
let [ssl, &ssl] = [&ssl, 0]
en
let fname = a:0 == 1 ? shellescape(a:1) : ''
let fname = a:0 ? shellescape(a:1) : ''
let cmd = shellescape(a:bin).' '.a:args.' '.fname
if &sh =~ 'cmd\.exe'
let cmd = substitute(cmd, '[&()@^<>|]', '^\0', 'g')
en
if exists('+ssl')
let &ssl = ssl
en
if has('iconv')
let last = s:enc != &enc ? s:enc : !empty($LANG) ? $LANG : &enc
let last = s:enc != &enc ? s:enc : !empty( $LANG ) ? $LANG : &enc
let cmd = iconv(cmd, &enc, last)
en
retu cmd
@ -170,12 +173,14 @@ fu! s:process(fname, ftype)
el
let data = s:exectagsonfile(a:fname, a:ftype)
let [raw, lines] = [split(data, '\n\+'), []]
for line in raw | if len(split(line, ';"')) == 2
let parsed_line = s:parseline(line)
if parsed_line != ''
cal add(lines, parsed_line)
for line in raw
if line !~# '^!_TAG_' && len(split(line, ';"')) == 2
let parsed_line = s:parseline(line)
if parsed_line != ''
cal add(lines, parsed_line)
en
en
en | endfo
endfo
let cache = { a:fname : { 'time': ftime, 'lines': lines } }
cal extend(g:ctrlp_buftags, cache)
en
@ -183,8 +188,8 @@ fu! s:process(fname, ftype)
endf
fu! s:parseline(line)
let eval = '\v^([^\t]+)\t(.+)\t\/\^(.+)\$\/\;\"\t(.+)\tline(no)?\:(\d+)'
let vals = matchlist(a:line, eval)
let vals = matchlist(a:line,
\ '\v^([^\t]+)\t(.+)\t[?/]\^?(.{-1,})\$?[?/]\;\"\t(.+)\tline(no)?\:(\d+)')
if vals == [] | retu '' | en
let [bufnr, bufname] = [bufnr('^'.vals[2].'$'), fnamemodify(vals[2], ':p:t')]
retu vals[1].' '.vals[4].'|'.bufnr.':'.bufname.'|'.vals[6].'| '.vals[3]
@ -200,6 +205,19 @@ fu! s:syntax()
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName,CtrlPTagKind
en
endf
fu! s:chknearby(pat)
if match(getline('.'), a:pat) < 0
let [int, forw, maxl] = [1, 1, line('$')]
wh !search(a:pat, 'W'.( forw ? '' : 'b' ))
if !forw
if int > maxl | brea | en
let int += int
en
let forw = !forw
endw
en
endf
" Public {{{1
fu! ctrlp#buffertag#init(fname)
let bufs = exists('s:btmode') && s:btmode
@ -208,7 +226,7 @@ fu! ctrlp#buffertag#init(fname)
let lines = []
for each in bufs
let bname = fnamemodify(each, ':p')
let tftype = get(split(getbufvar(bname, '&ft'), '\.'), 0, '')
let tftype = get(split(getbufvar('^'.bname.'$', '&ft'), '\.'), 0, '')
cal extend(lines, s:process(bname, tftype))
endfo
cal s:syntax()
@ -216,10 +234,14 @@ fu! ctrlp#buffertag#init(fname)
endf
fu! ctrlp#buffertag#accept(mode, str)
let vals = matchlist(a:str, '\v^[^\t]+\t+[^\t|]+\|(\d+)\:[^\t|]+\|(\d+)\|')
let vals = matchlist(a:str,
\ '\v^[^\t]+\t+[^\t|]+\|(\d+)\:[^\t|]+\|(\d+)\|\s(.+)$')
let bufnr = str2nr(get(vals, 1))
if bufnr
cal ctrlp#acceptfile(a:mode, bufname(bufnr), get(vals, 2))
cal ctrlp#acceptfile(a:mode, bufnr)
exe 'norm!' str2nr(get(vals, 2, line('.'))).'G'
cal s:chknearby('\V\C'.get(vals, 3, ''))
sil! norm! zvzz
en
endf

View File

@ -59,7 +59,8 @@ fu! ctrlp#changes#init(original_bufnr, bufnr)
let [swb, &swb] = [&swb, '']
let lines = []
for each in bufs
let fnamet = fnamemodify(bufname(each), ':t')
let bname = bufname(each)
let fnamet = fnamemodify(bname == '' ? '[No Name]' : bname, ':t')
cal extend(lines, s:process(s:changelist(each), each, fnamet))
endfo
sil! exe 'noa hid b' a:original_bufnr
@ -73,7 +74,7 @@ fu! ctrlp#changes#accept(mode, str)
let info = matchlist(a:str, '\t|\(\d\+\):[^|]\+|\(\d\+\):\(\d\+\)|$')
let bufnr = str2nr(get(info, 1))
if bufnr
cal ctrlp#acceptfile(a:mode, bufname(bufnr))
cal ctrlp#acceptfile(a:mode, bufnr)
cal cursor(get(info, 2), get(info, 3))
sil! norm! zvzz
en

View File

@ -32,12 +32,13 @@ fu! s:globdirs(dirs, depth)
let nr = len(g:ctrlp_alldirs)
if !empty(dirs) && !s:max(nr, s:maxfiles) && depth <= s:maxdepth
sil! cal ctrlp#progress(nr)
cal map(dirs, 'ctrlp#utils#fnesc(v:val, "g", ",")')
cal s:globdirs(join(dirs, ','), depth)
en
endf
fu! s:max(len, max)
retu a:max && a:len > a:max ? 1 : 0
retu a:max && a:len > a:max
endf
fu! s:nocache()
@ -53,7 +54,9 @@ fu! ctrlp#dir#init(...)
let cafile = cadir.ctrlp#utils#lash().ctrlp#utils#cachefile('dir')
if g:ctrlp_newdir || s:nocache() || !filereadable(cafile)
let [s:initcwd, g:ctrlp_alldirs] = [s:cwd, []]
cal s:globdirs(s:cwd, 0)
if !ctrlp#igncwd(s:cwd)
cal s:globdirs(ctrlp#utils#fnesc(s:cwd, 'g', ','), 0)
en
cal ctrlp#rmbasedir(g:ctrlp_alldirs)
if len(g:ctrlp_alldirs) <= s:compare_lim
cal sort(g:ctrlp_alldirs, 'ctrlp#complen')

View File

@ -33,9 +33,12 @@ fu! ctrlp#line#init()
let [bufs, lines] = [ctrlp#buffers('id'), []]
for bufnr in bufs
let [lfb, bufn] = [getbufline(bufnr, 1, '$'), bufname(bufnr)]
let lfb = lfb == [] ? ctrlp#utils#readfile(fnamemodify(bufn, ':p')) : lfb
if lfb == [] && bufn != ''
let lfb = ctrlp#utils#readfile(fnamemodify(bufn, ':p'))
en
cal map(lfb, 'tr(v:val, '' '', '' '')')
let [linenr, len_lfb, buft] = [1, len(lfb), fnamemodify(bufn, ':t')]
let [linenr, len_lfb] = [1, len(lfb)]
let buft = bufn == '' ? '[No Name]' : fnamemodify(bufn, ':t')
wh linenr <= len_lfb
let lfb[linenr - 1] .= ' |'.buft.'|'.bufnr.':'.linenr.'|'
let linenr += 1
@ -50,7 +53,7 @@ fu! ctrlp#line#accept(mode, str)
let info = matchlist(a:str, '\t|[^|]\+|\(\d\+\):\(\d\+\)|$')
let bufnr = str2nr(get(info, 1))
if bufnr
cal ctrlp#acceptfile(a:mode, bufname(bufnr), get(info, 2))
cal ctrlp#acceptfile(a:mode, bufnr, get(info, 2))
en
endf

View File

@ -41,7 +41,11 @@ fu! s:getnewmix(cwd, clim)
if exists('+ssl') && &ssl
cal map(mrufs, 'tr(v:val, "\\", "/")')
en
let bufs = map(ctrlp#buffers('id'), 'fnamemodify(bufname(v:val), ":p")')
let allbufs = map(ctrlp#buffers(), 'fnamemodify(v:val, ":p")')
let [bufs, ubufs] = [[], []]
for each in allbufs
cal add(filereadable(each) ? bufs : ubufs, each)
endfo
let mrufs = bufs + filter(mrufs, 'index(bufs, v:val) < 0')
if len(mrufs) > len(g:ctrlp_lines)
cal filter(mrufs, 'stridx(v:val, a:cwd)')
@ -53,6 +57,7 @@ fu! s:getnewmix(cwd, clim)
if id >= 0 | cal remove(g:ctrlp_lines, id) | en
endfo
en
let mrufs += ubufs
cal map(mrufs, 'fnamemodify(v:val, ":.")')
let g:ctrlp_lines = len(mrufs) > len(g:ctrlp_lines)
\ ? g:ctrlp_lines + mrufs : mrufs + g:ctrlp_lines

View File

@ -14,6 +14,7 @@ fu! ctrlp#mrufiles#opts()
\ 'exclude': ['s:ex', ''],
\ 'case_sensitive': ['s:cseno', 1],
\ 'relative': ['s:re', 0],
\ 'save_on_update': ['s:soup', 1],
\ }]
for [ke, va] in items(opts)
let [{va[0]}, {pref.ke}] = [pref.ke, exists(pref.ke) ? {pref.ke} : va[1]]
@ -37,29 +38,47 @@ fu! s:chop(mrufs)
retu a:mrufs
endf
fu! s:reformat(mrufs)
fu! s:reformat(mrufs, ...)
let cwd = getcwd()
let cwd .= cwd !~ '[\/]$' ? ctrlp#utils#lash() : ''
if {s:re}
let cwd = exists('+ssl') ? tr(getcwd(), '/', '\') : getcwd()
let cwd = exists('+ssl') ? tr(cwd, '/', '\') : cwd
cal filter(a:mrufs, '!stridx(v:val, cwd)')
en
retu map(a:mrufs, 'fnamemodify(v:val, ":.")')
if a:0 && a:1 == 'raw' | retu a:mrufs | en
let idx = strlen(cwd)
if exists('+ssl') && &ssl
let cwd = tr(cwd, '\', '/')
cal map(a:mrufs, 'tr(v:val, "\\", "/")')
en
retu map(a:mrufs, '!stridx(v:val, cwd) ? strpart(v:val, idx) : v:val')
endf
fu! s:record(bufnr)
if s:locked | retu | en
let bufnr = a:bufnr + 0
if bufnr <= 0 | retu | en
let bufname = bufname(bufnr)
if empty(bufname) | retu | en
let fn = fnamemodify(bufname, ':p')
let fn = exists('+ssl') ? tr(fn, '/', '\') : fn
cal filter(s:mrbs, 'v:val != bufnr')
cal insert(s:mrbs, bufnr)
if ( !empty({s:in}) && fn !~# {s:in} ) || ( !empty({s:ex}) && fn =~# {s:ex} )
\ || !empty(&bt) || !filereadable(fn) | retu
if bufnr > 0 && !empty(bufname)
cal filter(s:mrbs, 'v:val != bufnr')
cal insert(s:mrbs, bufnr)
cal s:addtomrufs(bufname)
en
endf
fu! s:addtomrufs(fname)
let fn = fnamemodify(a:fname, ':p')
let fn = exists('+ssl') ? tr(fn, '/', '\') : fn
if ( !empty({s:in}) && fn !~# {s:in} ) || ( !empty({s:ex}) && fn =~# {s:ex} )
\ || !empty(getbufvar('^'.fn.'$', '&bt')) || !filereadable(fn) | retu
en
let idx = index(s:mrufs, fn, 0, !{s:cseno})
if idx
cal filter(s:mrufs, 'v:val !='.( {s:cseno} ? '#' : '?' ).' fn')
cal insert(s:mrufs, fn)
if {s:soup} && idx < 0
cal s:savetofile(s:mergelists())
en
en
cal filter(s:mrufs, 'v:val !='.( {s:cseno} ? '#' : '?' ).' fn')
cal insert(s:mrufs, fn)
endf
fu! s:savetofile(mrufs)
@ -67,28 +86,40 @@ fu! s:savetofile(mrufs)
endf
" Public {{{1
fu! ctrlp#mrufiles#refresh(...)
let s:mrufs = s:mergelists()
cal filter(s:mrufs, '!empty(ctrlp#utils#glob(v:val, 1)) && !s:excl(v:val)')
let mrufs = s:mergelists()
cal filter(mrufs, '!empty(ctrlp#utils#glob(v:val, 1)) && !s:excl(v:val)')
if exists('+ssl')
cal map(mrufs, 'tr(v:val, "/", "\\")')
cal map(s:mrufs, 'tr(v:val, "/", "\\")')
cal filter(s:mrufs, 'count(s:mrufs, v:val) == 1')
let cond = 'count(mrufs, v:val, !{s:cseno}) == 1'
cal filter(mrufs, cond)
cal filter(s:mrufs, cond)
en
cal s:savetofile(s:mrufs)
retu a:0 && a:1 == 'raw' ? [] : s:reformat(copy(s:mrufs))
cal s:savetofile(mrufs)
retu a:0 && a:1 == 'raw' ? [] : s:reformat(mrufs)
endf
fu! ctrlp#mrufiles#remove(files)
let s:mrufs = []
let mrufs = []
if a:files != []
let s:mrufs = s:mergelists()
cal filter(s:mrufs, 'index(a:files, v:val, 0, '.(!{s:cseno}).') < 0')
let mrufs = s:mergelists()
let cond = 'index(a:files, v:val, 0, !{s:cseno}) < 0'
cal filter(mrufs, cond)
cal filter(s:mrufs, cond)
en
cal s:savetofile(mrufs)
retu s:reformat(mrufs)
endf
fu! ctrlp#mrufiles#add(fn)
if !empty(a:fn)
cal s:addtomrufs(a:fn)
en
cal s:savetofile(s:mrufs)
retu s:reformat(copy(s:mrufs))
endf
fu! ctrlp#mrufiles#list(...)
retu a:0 ? a:1 == 'raw' ? s:mergelists() : 0 : s:reformat(s:mergelists())
retu a:0 ? a:1 == 'raw' ? s:reformat(s:mergelists(), a:1) : 0
\ : s:reformat(s:mergelists())
endf
fu! ctrlp#mrufiles#bufs()
@ -108,7 +139,7 @@ fu! ctrlp#mrufiles#init()
let s:locked = 0
aug CtrlPMRUF
au!
au BufAdd,BufEnter,BufLeave,BufUnload * cal s:record(expand('<abuf>', 1))
au BufAdd,BufEnter,BufLeave,BufWritePost * cal s:record(expand('<abuf>', 1))
au QuickFixCmdPre *vimgrep* let s:locked = 1
au QuickFixCmdPost *vimgrep* let s:locked = 0
au VimLeavePre * cal s:savetofile(s:mergelists())

View File

@ -40,18 +40,15 @@ fu! ctrlp#quickfix#init()
endf
fu! ctrlp#quickfix#accept(mode, str)
let items = matchlist(a:str, '^\([^|]\+\ze\)|\(\d\+\):\(\d\+\)|')
if items == [] | retu | en
let [md, filpath] = [a:mode, fnamemodify(items[1], ':p')]
if empty(filpath) | retu | en
cal ctrlp#exit()
let cmd = md == 't' ? 'tabe' : md == 'h' ? 'new' : md == 'v' ? 'vne'
\ : ctrlp#normcmd('e')
let cmd = cmd == 'e' && &modified ? 'hid e' : cmd
exe cmd ctrlp#fnesc(filpath)
cal cursor(items[2], items[3])
let vals = matchlist(a:str, '^\([^|]\+\ze\)|\(\d\+\):\(\d\+\)|')
if vals == [] || vals[1] == '' | retu | en
cal ctrlp#acceptfile(a:mode, vals[1])
let cur_pos = getpos('.')[1:2]
if cur_pos != [1, 1] && cur_pos != map(vals[2:3], 'str2nr(v:val)')
mark '
en
cal cursor(vals[2], vals[3])
sil! norm! zvzz
cal ctrlp#setlcdir()
endf
fu! ctrlp#quickfix#id()

View File

@ -24,23 +24,26 @@ let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
let s:filecounts = {}
" Utilities {{{1
fu! s:nocache()
retu !s:caching || ( s:caching > 1 && get(s:filecounts, s:cwd) < s:caching )
retu g:ctrlp_newrts ||
\ !s:caching || ( s:caching > 1 && get(s:filecounts, s:cwd) < s:caching )
endf
" Public {{{1
fu! ctrlp#rtscript#init(caching)
let [s:caching, s:cwd] = [a:caching, getcwd()]
if g:ctrlp_newrts || s:nocache()
\ || !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[0] == &rtp )
if s:nocache() ||
\ !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[0] == &rtp )
sil! cal ctrlp#progress('Indexing...')
let entries = split(globpath(&rtp, '**/*.*'), "\n")
let entries = split(globpath(ctrlp#utils#fnesc(&rtp, 'g'), '**/*.*'), "\n")
cal filter(entries, 'count(entries, v:val) == 1')
let [entries, echoed] = [ctrlp#dirnfile(entries)[1], 1]
el
let [entries, results] = g:ctrlp_rtscache[2:3]
en
if g:ctrlp_newrts || s:nocache()
\ || !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[:1] == [&rtp, s:cwd] )
if !exists('echoed') | sil! cal ctrlp#progress('Processing...') | en
if s:nocache() ||
\ !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[:1] == [&rtp, s:cwd] )
if !exists('echoed')
sil! cal ctrlp#progress('Processing...')
en
let results = map(copy(entries), 'fnamemodify(v:val, '':.'')')
en
let [g:ctrlp_rtscache, g:ctrlp_newrts] = [[&rtp, s:cwd, entries, results], 0]

View File

@ -54,11 +54,11 @@ fu! s:filter(tags)
let nr = 0
wh 0 < 1
if a:tags == [] | brea | en
if a:tags[nr] =~ '^!' && a:tags[nr] !~ '^!_TAG_'
if a:tags[nr] =~ '^!' && a:tags[nr] !~# '^!_TAG_'
let nr += 1
con
en
if a:tags[nr] =~ '^!_TAG_' && len(a:tags) > nr
if a:tags[nr] =~# '^!_TAG_' && len(a:tags) > nr
cal remove(a:tags, nr)
el
brea
@ -97,15 +97,19 @@ fu! ctrlp#tag#accept(mode, str)
\ 'e': ['', 'tj'],
\ }
let cmd = fnd[0] == 1 ? cmds[a:mode][0] : cmds[a:mode][1]
let cmd = cmd == 'tj' && &mod ? 'hid '.cmd : cmd
let cmd = a:mode == 'e' && ctrlp#modfilecond(!&aw)
\ ? ( cmd == 'tj' ? 'stj' : 'sp' ) : cmd
let cmd = a:mode == 't' ? ctrlp#tabcount().cmd : cmd
if fnd[0] == 1
if cmd != ''
exe cmd
en
exe fnd[1].'ta' tg
let save_cst = &cst
set cst&
cal feedkeys(":".fnd[1]."ta ".tg."\r", 'nt')
let &cst = save_cst
el
exe cmd tg
cal feedkeys(":".cmd." ".tg."\r", 'nt')
en
cal ctrlp#setlcdir()
endf

View File

@ -8,25 +8,28 @@
fu! ctrlp#utils#lash()
retu &ssl || !exists('+ssl') ? '/' : '\'
endf
let s:lash = ctrlp#utils#lash()
fu! s:lash(...)
retu ( a:0 ? a:1 : getcwd() ) !~ '[\/]$' ? s:lash : ''
endf
fu! ctrlp#utils#opts()
let usrhome = $HOME.s:lash($HOME)
let s:lash = ctrlp#utils#lash()
let usrhome = $HOME . s:lash( $HOME )
let cahome = exists('$XDG_CACHE_HOME') ? $XDG_CACHE_HOME : usrhome.'.cache'
let s:cache_dir = isdirectory(usrhome.'.ctrlp_cache')
let cadir = isdirectory(usrhome.'.ctrlp_cache')
\ ? usrhome.'.ctrlp_cache' : cahome.s:lash(cahome).'ctrlp'
if exists('g:ctrlp_cache_dir')
let s:cache_dir = expand(g:ctrlp_cache_dir, 1)
if isdirectory(s:cache_dir.s:lash(s:cache_dir).'.ctrlp_cache')
let s:cache_dir = s:cache_dir.s:lash(s:cache_dir).'.ctrlp_cache'
let cadir = expand(g:ctrlp_cache_dir, 1)
if isdirectory(cadir.s:lash(cadir).'.ctrlp_cache')
let cadir = cadir.s:lash(cadir).'.ctrlp_cache'
en
en
let s:cache_dir = cadir
endf
cal ctrlp#utils#opts()
let s:wig_cond = v:version > 702 || ( v:version == 702 && has('patch051') )
" Files and Directories {{{1
fu! ctrlp#utils#cachedir()
retu s:cache_dir
@ -64,8 +67,43 @@ fu! ctrlp#utils#writecache(lines, ...)
endf
fu! ctrlp#utils#glob(...)
let cond = v:version > 702 || ( v:version == 702 && has('patch051') )
retu call('glob', cond ? a:000 : [a:1])
let path = ctrlp#utils#fnesc(a:1, 'g')
retu s:wig_cond ? glob(path, a:2) : glob(path)
endf
fu! ctrlp#utils#globpath(...)
retu call('globpath', s:wig_cond ? a:000 : a:000[:1])
endf
fu! ctrlp#utils#fnesc(path, type, ...)
if exists('*fnameescape')
if exists('+ssl')
if a:type == 'c'
let path = escape(a:path, '%#')
elsei a:type == 'f'
let path = fnameescape(a:path)
elsei a:type == 'g'
let path = escape(a:path, '?*')
en
let path = substitute(path, '[', '[[]', 'g')
el
let path = fnameescape(a:path)
en
el
if exists('+ssl')
if a:type == 'c'
let path = escape(a:path, '%#')
elsei a:type == 'f'
let path = escape(a:path, " \t\n%#*?|<\"")
elsei a:type == 'g'
let path = escape(a:path, '?*')
en
let path = substitute(path, '[', '[[]', 'g')
el
let path = escape(a:path, " \t\n*?[{`$\\%#'\"|!<")
en
en
retu a:0 ? escape(path, a:1) : path
endf
"}}}

View File

@ -1,4 +1,4 @@
*ctrlp.txt* Fuzzy file, buffer, mru, tag, ... finder. v1.78
*ctrlp.txt* Fuzzy file, buffer, mru, tag, ... finder. v1.79
*CtrlP* *ControlP* *'ctrlp'* *'ctrl-p'*
===============================================================================
# #
@ -35,50 +35,53 @@ OPTIONS *ctrlp-options*
Overview:~
|loaded_ctrlp| Disable the plugin.
|ctrlp_map| Default mapping.
|ctrlp_cmd| Default command used for the default mapping.
|ctrlp_by_filename| Default to filename mode or not.
|ctrlp_regexp| Default to regexp mode or not.
|ctrlp_match_window_bottom| Where to show the match window.
|ctrlp_match_window_reversed| Sort order in the match window.
|ctrlp_max_height| Max height of the match window.
|ctrlp_switch_buffer| Jump to an open buffer if already opened.
|ctrlp_reuse_window| Reuse special windows (help, quickfix, etc).
|ctrlp_tabpage_position| Where to put the new tab page.
|ctrlp_working_path_mode| How to set CtrlP's local working directory.
|ctrlp_root_markers| Additional, high priority root markers.
|ctrlp_use_caching| Use per-session caching or not.
|ctrlp_clear_cache_on_exit| Keep cache after exiting Vim or not.
|ctrlp_cache_dir| Location of the cache directory.
|ctrlp_dotfiles| Ignore dotfiles and dotdirs or not.
|ctrlp_custom_ignore| Hide stuff when using |globpath()|.
|ctrlp_max_files| Number of files to scan initially.
|ctrlp_max_depth| Directory depth to recurse into when scanning.
|ctrlp_user_command| Use an external scanner.
|ctrlp_max_history| Number of entries saved in the prompt history.
|ctrlp_open_new_file| How to open a file created by <c-y>.
|ctrlp_open_multiple_files| How to open files selected by <c-z>.
|ctrlp_arg_map| Intercept <c-y> and <c-o> or not.
|ctrlp_follow_symlinks| Follow symbolic links or not.
|ctrlp_lazy_update| Only update when typing has stopped.
|ctrlp_default_input| Seed the prompt with an initial string.
|ctrlp_use_migemo| Use Migemo patterns for Japanese filenames.
|ctrlp_prompt_mappings| Change the mappings in the prompt.
|loaded_ctrlp|................Disable the plugin.
|ctrlp_map|...................Default mapping.
|ctrlp_cmd|...................Default command used for the default mapping.
|ctrlp_by_filename|...........Default to filename mode or not.
|ctrlp_regexp|................Default to regexp mode or not.
|ctrlp_match_window_bottom|...Where to show the match window.
|ctrlp_match_window_reversed|.Sort order in the match window.
|ctrlp_max_height|............Max height of the match window.
|ctrlp_switch_buffer|.........Jump to an open buffer if already opened.
|ctrlp_reuse_window|..........Reuse special windows (help, quickfix, etc).
|ctrlp_tabpage_position|......Where to put the new tab page.
|ctrlp_working_path_mode|.....How to set CtrlP's local working directory.
|ctrlp_root_markers|..........Additional, high priority root markers.
|ctrlp_use_caching|...........Use per-session caching or not.
|ctrlp_clear_cache_on_exit|...Keep cache after exiting Vim or not.
|ctrlp_cache_dir|.............Location of the cache directory.
|ctrlp_show_hidden|...........Ignore dotfiles and dotdirs or not.
|ctrlp_custom_ignore|.........Hide stuff when using |globpath()|.
|ctrlp_max_files|.............Number of files to scan initially.
|ctrlp_max_depth|.............Directory depth to recurse into when scanning.
|ctrlp_user_command|..........Use an external scanner.
|ctrlp_max_history|...........Number of entries saved in the prompt history.
|ctrlp_open_new_file|.........How to open a file created by <c-y>.
|ctrlp_open_multiple_files|...How to open files selected by <c-z>.
|ctrlp_arg_map|...............Intercept <c-y> and <c-o> or not.
|ctrlp_follow_symlinks|.......Follow symbolic links or not.
|ctrlp_lazy_update|...........Only update when typing has stopped.
|ctrlp_default_input|.........Seed the prompt with an initial string.
|ctrlp_abbrev|................Input abbreviations.
|ctrlp_key_loop|..............Use input looping for multi-byte input.
|ctrlp_use_migemo|............Use Migemo patterns for Japanese filenames.
|ctrlp_prompt_mappings|.......Change the mappings inside the prompt.
MRU mode:
|ctrlp_mruf_max| Max MRU entries to remember.
|ctrlp_mruf_exclude| Files that shouldn't be remembered.
|ctrlp_mruf_include| Files to be remembered.
|ctrlp_mruf_relative| Show only MRU files in the working directory.
|ctrlp_mruf_default_order| Disable sorting.
|ctrlp_mruf_case_sensitive| MRU files are case sensitive or not.
|ctrlp_mruf_max|..............Max MRU entries to remember.
|ctrlp_mruf_exclude|..........Files that shouldn't be remembered.
|ctrlp_mruf_include|..........Files to be remembered.
|ctrlp_mruf_relative|.........Show only MRU files in the working directory.
|ctrlp_mruf_default_order|....Disable sorting.
|ctrlp_mruf_case_sensitive|...MRU files are case sensitive or not.
|ctrlp_mruf_save_on_update|...Save to disk whenever a new entry is added.
Advanced options:
|ctrlp_open_func| Use custom file opening functions.
|ctrlp_status_func| Change CtrlP's two statuslines.
|ctrlp_buffer_func| Call custom functions in the CtrlP buffer.
|ctrlp_match_func| Replace the built-in matching algorithm.
|ctrlp_open_func|.............Use custom file opening functions.
|ctrlp_status_func|...........Change CtrlP's two statuslines.
|ctrlp_buffer_func|...........Call custom functions in the CtrlP buffer.
|ctrlp_match_func|............Replace the built-in matching algorithm.
-------------------------------------------------------------------------------
Detailed descriptions and default values:~
@ -128,13 +131,16 @@ Set the maximum height of the match window: >
<
*'g:ctrlp_switch_buffer'*
When opening a file with <cr> or <c-t>, if the file's already opened somewhere
CtrlP will try to jump to it instead of opening a new instance: >
let g:ctrlp_switch_buffer = 2
When opening a file, if it's already open in a window somewhere, CtrlP will try
to jump to it instead of opening a new instance: >
let g:ctrlp_switch_buffer = 'Et'
<
1 - only jump to the buffer if it's opened in the current tab.
2 - jump tab as well if the buffer's opened in another tab.
0 - disable this feature.
e - jump when <cr> is pressed, but only to windows in the current tab.
t - jump when <c-t> is pressed, but only to windows in another tab.
v - like "e", but jump when <c-v> is pressed.
h - like "e", but jump when <c-x> is pressed.
E, T, V, H - like "e", "t", "v", and "h", but jump to windows anywhere.
0 or <empty> - disable this feature.
*'g:ctrlp_reuse_window'*
When opening a file with <cr>, CtrlP avoids opening it in windows created by
@ -160,24 +166,29 @@ Where to put the new tab page when opening one: >
*'g:ctrlp_working_path_mode'*
When starting up, CtrlP sets its local working directory according to this
variable: >
let g:ctrlp_working_path_mode = 'rc'
let g:ctrlp_working_path_mode = 'ra'
<
c - the directory of the current file.
a - like "c", but only applies when the current working directory outside of
CtrlP isn't a direct ancestor of the directory of the current file.
r - the nearest ancestor that contains one of these directories or files:
.git .hg .svn .bzr _darcs
{empty-string} - don't manage working directory.
w - begin finding a root from the current working directory outside of CtrlP
instead of from the directory of the current file (default). Only applies
when "r" is also present.
0 or <empty> - disable this feature.
Note #1: you can use b:ctrlp_working_path_mode (a |b:var|) to set this option
on a per buffer basis.
Note #1: if "a" or "c" is included with "r", use the behavior of "a" or "c" (as
a fallback) when a root can't be found.
Note #2: with both 'r' and 'c' in the option, when a root isn't found, use the
directory of the current file.
Note #2: you can use 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 (.git,
.hg, .svn, .bzr, and _darcs). Your markers will take precedence: >
let g:ctrlp_root_markers = ['']
<
Note: you can use a |b:var| to set this option on a per buffer basis.
*'g:ctrlp_use_caching'*
Enable/Disable per-session caching: >
@ -187,6 +198,7 @@ Enable/Disable per-session caching: >
1 - Enable caching.
n - When bigger than 1, disable caching and use the number as the limit to
enable caching again.
Note: you can quickly purge the cache by pressing <F5> while inside CtrlP.
*'g:ctrlp_clear_cache_on_exit'*
@ -200,18 +212,20 @@ Set the directory to store the cache files: >
let g:ctrlp_cache_dir = $HOME.'/.cache/ctrlp'
<
*'g:ctrlp_dotfiles'*
Set this to 0 if you don't want CtrlP to scan for dotfiles and dotdirs: >
let g:ctrlp_dotfiles = 1
*'g:ctrlp_show_hidden'*
Set this to 1 if you want CtrlP to scan for dotfiles and dotdirs: >
let g:ctrlp_show_hidden = 0
<
Note: does not apply when a command defined with |g:ctrlp_user_command| is
being used.
*'ctrlp-wildignore'*
You can use Vim's |'wildignore'| to exclude files and directories from the
results.
Examples: >
" Excluding version control directories
set wildignore+=*/.git/*,*/.hg/*,*/.svn/* " Linux/MacOSX
set wildignore+=.git\*,.hg\*,.svn\* " Windows
set wildignore+=*/.git/*,*/.hg/*,*/.svn/* " Linux/MacOSX
set wildignore+=*\\.git\\*,*\\.hg\\*,*\\.svn\\* " Windows ('noshellslash')
<
Note #1: the `*/` in front of each directory glob is required.
@ -226,25 +240,36 @@ 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 = '\v[\/]\.(git|hg|svn)$'
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git$\|\.hg$\|\.svn$',
\ 'file': '\.exe$\|\.so$\|\.dll$',
\ 'dir': '\v[\/]\.(git|hg|svn)$',
\ 'file': '\v\.(exe|so|dll)$',
\ 'link': 'SOME_BAD_SYMBOLIC_LINKS',
\ }
let g:ctrlp_custom_ignore = {
\ 'file': '\v(\.cpp|\.h|\.hh|\.cxx)@<!$'
\ }
<
Note: ignoring only applies when |globpath()| is used to scan for files.
Note #1: by default, |wildignore| and |g:ctrlp_custom_ignore| only apply when
|globpath()| is used to scan for files, thus these options do not apply when a
command defined with |g:ctrlp_user_command| is being used.
Note #2: when changing the option's variable type, remember to |:unlet| it
first or restart Vim to avoid the "E706: Variable type mismatch" error.
*'g:ctrlp_max_files'*
The maximum number of files to scan, set to 0 for no limit: >
let g:ctrlp_max_files = 10000
<
Note: does not apply when a command defined with |g:ctrlp_user_command| is
being used.
*'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.
Note: does not apply when a command defined with |g:ctrlp_user_command| is
being used.
*'g:ctrlp_user_command'*
Specify an external tool to use for listing files instead of using Vim's
@ -257,8 +282,10 @@ Examples: >
<
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$'
let g:ctrlp_user_command =
\ 'find %s -type f | grep -v -P "\.jpg$|/tmp/"' " MacOSX/Linux
let g:ctrlp_user_command =
\ 'dir %s /-n /b /s /a-d | findstr /v /l ".jpg \\tmp\\"' " Windows
<
Use a version control listing command when inside a repository, this is faster
when scanning large projects: >
@ -268,12 +295,16 @@ when scanning large projects: >
\ 1: [root_marker_1, listing_command_1],
\ n: [root_marker_n, listing_command_n],
\ },
\ 'fallback': fallback_command
\ 'fallback': fallback_command,
\ 'ignore': 0 or 1
\ }
<
Examples: >
Some examples: >
" Single VCS, listing command does not list untracked files:
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files']
let g:ctrlp_user_command = ['.hg', 'hg --cwd %s locate -I .']
" Multiple VCS's:
let g:ctrlp_user_command = {
\ 'types': {
\ 1: ['.git', 'cd %s && git ls-files'],
@ -281,9 +312,29 @@ Examples: >
\ },
\ 'fallback': 'find %s -type f'
\ }
" Single VCS, listing command lists untracked files (slower):
let g:ctrlp_user_command =
\ ['.git', 'cd %s && git ls-files . -co --exclude-standard']
let g:ctrlp_user_command =
\ ['.hg', 'hg --cwd %s status -numac -I . $(hg root)'] " MacOSX/Linux
let g:ctrlp_user_command = ['.hg', 'for /f "tokens=1" %%a in (''hg root'') '
\ . 'do hg --cwd %s status -numac -I . %%a'] " Windows
<
If the fallback_command is empty or not defined, |globpath()| will then be used
when searching outside a repo.
Note #1: if the fallback_command is empty or the 'fallback' key is not defined,
|globpath()| will then be used when scanning outside of a repository.
Note #2: unless the |Dictionary| format is used and 'ignore' is defined and set
to 1, the |wildignore| and |g:ctrlp_custom_ignore| options do not apply when
these custom commands are being used. When not present, 'ignore' is set to 0 by
default to retain the performance advantage of using external commands.
Note #3: when changing the option's variable type, remember to |:unlet| it
first or restart Vim to avoid the "E706: Variable type mismatch" error.
Note #4: you can use a |b:var| to set this option on a per buffer basis.
*'g:ctrlp_max_history'*
The maximum number of input strings you want CtrlP to remember. The default
@ -294,14 +345,13 @@ Set to 0 to disable prompt's 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
>
pressing <c-y>: >
let g:ctrlp_open_new_file = 'v'
<
t - in a new tab.
h - in a new horizontal split.
v - in a new vertical split.
r - in the current window.
*'g:ctrlp_open_multiple_files'*
If non-zero, this will enable opening multiple files with <c-z> and <c-o>: >
@ -322,7 +372,8 @@ For the letters:
i - all files as hidden buffers.
j - after opening, jump to the first opened tab or window.
r - open the first file in the current window, then the remaining files in
new splits or new tabs depending on which of h, v and t is also present.
new splits or new tabs depending on which of "h", "v" and "t" is also
present.
*'g:ctrlp_arg_map'*
When this is set to 1, the <c-o> and <c-y> mappings will accept one extra key
@ -348,6 +399,9 @@ If non-zero, CtrlP will follow symbolic links when listing files: >
1 - follow but ignore looped internal symlinks to avoid duplicates.
2 - follow all symlinks indiscriminately.
Note: does not apply when a command defined with |g:ctrlp_user_command| is
being used.
*'g:ctrlp_lazy_update'*
Set this to 1 to enable the lazy-update feature: only update the match window
after typing's been stopped for a certain amount of time: >
@ -366,6 +420,68 @@ as the default input: >
let g:ctrlp_default_input = 'anystring'
<
*'g:ctrlp_abbrev'*
Define input abbreviations that can be expanded (either internally or visibly)
in the prompt: >
let g:ctrlp_abbrev = {}
<
Examples: >
let g:ctrlp_abbrev = {
\ 'gmode': 'i',
\ 'abbrevs': [
\ {
\ 'pattern': '^cd b',
\ 'expanded': '@cd ~/.vim/bundle',
\ 'mode': 'pfrz',
\ },
\ {
\ 'pattern': '\(^@.\+\|\\\@<!:.\+\)\@<! ',
\ 'expanded': '.\{-}',
\ 'mode': 'pfr',
\ },
\ {
\ 'pattern': '\\\@<!:.\+\zs\\\@<! ',
\ 'expanded': '\ ',
\ 'mode': 'pfz',
\ },
\ ]
\ }
<
The 'pattern' string is regexp matched against the entered input. The expansion
is as if the 'expanded' string was typed into the prompt.
For 'gmode' (optional):
i - expand internally (default).
t - insert the expanded results into the prompt as you type.
k - insert the expanded results when a non-keyword character is typed. Only
applies when "t" is also present.
For 'mode' (of each entry; optional):
f - only in filename mode.
p - only in full path mode.
r - only in regexp mode.
z - only in fuzzy mode.
n - only when creating a new file with <c-y> (use the expanded string in the
new filename).
c - only when auto-completing directory names with <tab> (expand the pattern
immediately before doing the auto-completion).
<empty> or not defined - always enable.
Note: the abbrev entries are evaluated in sequence, so a later entry can be
evaluated against the expanded result of a previous entry; this includes itself
when 'gmode' is "t".
*'g:ctrlp_key_loop'*
An experimental feature. Set this to 1 to enable input looping for the typing
of multi-byte characters: >
let g:ctrlp_key_loop = 0
<
Note #1: when set, this option resets the |g:ctrlp_lazy_update| option.
Note #2: you can toggle this feature inside the prompt with a custom mapping: >
let g:ctrlp_prompt_mappings = { 'ToggleKeyLoop()': ['<F3>'] }
<
*'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: >
@ -412,9 +528,8 @@ only need to keep the lines that you've changed the values (inside []): >
\ 'PrtExit()': ['<esc>', '<c-c>', '<c-g>'],
\ }
<
Note: In some terminals, it's not possible to remap <c-h> without also changing
<bs> (|keycodes|). 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 plugin's
Note: if pressing <bs> moves the cursor one character to the left instead of
deleting a character for you, add this to your |.vimrc| to disable the plugin's
default <c-h> mapping: >
let g:ctrlp_prompt_mappings = { 'PrtCurLeft()': ['<left>', '<c-^>'] }
<
@ -460,6 +575,12 @@ MRU entries: >
let g:ctrlp_mruf_case_sensitive = 1
<
*'g:ctrlp_mruf_save_on_update'*
Set this to 0 to disable saving of the MRU list to hard drive whenever a new
entry is added, saving will then only occur when exiting Vim: >
let g:ctrlp_mruf_save_on_update = 1
<
----------------------------------------
Advanced options:~
@ -634,12 +755,13 @@ COMMANDS *ctrlp-commands*
Open CtrlP in find Most-Recently-Used file mode.
*:CtrlPLastMode*
:CtrlPLastMode
Open CtrlP in the last mode used.
:CtrlPLastMode [--dir]
Open CtrlP in the last mode used. When having the "--dir" argument, also
reuse the last working directory.
*:CtrlPRoot*
:CtrlPRoot
This acts like |:CtrlP| with |g:ctrlp_working_path_mode| = 'rc' and ignores
This acts like |:CtrlP| with |g:ctrlp_working_path_mode| = 'r' and ignores
the variable's current value.
*:CtrlPClearCache*
@ -768,7 +890,22 @@ Opening multiple files:~
- Mark/unmark a file to create a new file in its directory using <c-y>.
<c-o>
Open files marked by <c-z>.
- Open files marked by <c-z>.
- When no file has been marked by <c-z>, open a console dialog with the
following options:
Open the selected file:
t - in a tab page.
v - in a vertical split.
h - in a horizontal split.
r - in the current window.
i - as a hidden buffer.
x - (optional) with the function defined in |g:ctrlp_open_func|.
Other options (not shown):
a - mark all files in the match window.
d - change CtrlP's local working directory to the selected file's
directory and switch to find file mode.
Function keys:~
@ -891,7 +1028,7 @@ Available extensions:~
*:CtrlPTag*
* Tag mode:~
- Name: 'tag'
- Command: ':CtrlPTag'
- Command: ":CtrlPTag"
- Search for a tag within a generated central tags file, and jump to the
definition. Use the Vim's option |'tags'| to specify the names and the
locations of the tags file(s).
@ -901,21 +1038,21 @@ Available extensions:~
*:CtrlPBufTagAll*
* Buffer Tag mode:~
- Name: 'buffertag'
- Commands: ':CtrlPBufTag [buffer]',
':CtrlPBufTagAll'.
- Commands: ":CtrlPBufTag [buffer]",
":CtrlPBufTagAll".
- Search for a tag within the current buffer or all listed buffers and jump
to the definition. Requires |exuberant_ctags| or compatible programs.
*:CtrlPQuickfix*
* Quickfix mode:~
- Name: 'quickfix'
- Command: ':CtrlPQuickfix'
- Command: ":CtrlPQuickfix"
- Search for an entry in the current quickfix errors and jump to it.
*:CtrlPDir*
* Directory mode:~
- Name: 'dir'
- Command: ':CtrlPDir [starting-directory]'
- 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.
@ -927,42 +1064,42 @@ Available extensions:~
*:CtrlPRTS*
* Runtime script mode:~
- Name: 'rtscript'
- Command: ':CtrlPRTS'
- Command: ":CtrlPRTS"
- Search for files (vimscripts, docs, snippets...) in runtimepath.
*:CtrlPUndo*
* Undo mode:~
- Name: 'undo'
- Command: ':CtrlPUndo'
- Command: ":CtrlPUndo"
- Browse undo history.
*:CtrlPLine*
* Line mode:~
- Name: 'line'
- Command: ':CtrlPLine'
- Command: ":CtrlPLine"
- Search for a line in all listed buffers.
*:CtrlPChange*
*:CtrlPChangeAll*
* Change list mode:~
- Name: 'changes'
- Commands: ':CtrlPChange [buffer]',
':CtrlPChangeAll'.
- Commands: ":CtrlPChange [buffer]",
":CtrlPChangeAll".
- Search for and jump to a recent change in the current buffer or in all
listed buffers.
*:CtrlPMixed*
* Mixed mode:~
- Name: 'mixed'
- Command: ':CtrlPMixed'
- Command: ":CtrlPMixed"
- Search in files, buffers and MRU files at the same time.
*:CtrlPBookmarkDir*
*:CtrlPBookmarkDirAdd*
* BookmarkDir mode:~
- Name: 'bookmarkdir'
- Commands: ':CtrlPBookmarkDir',
':CtrlPBookmarkDirAdd [directory]'.
- Commands: ":CtrlPBookmarkDir",
":CtrlPBookmarkDirAdd [directory]".
- Search for a bookmarked directory and change the working directory to it.
- Mappings:
+ <cr> change the local working directory for CtrlP, keep it open and
@ -1027,8 +1164,8 @@ Highlighting:~
Statuslines:~
* Highlight groups:
CtrlPMode1 : 'prt' or 'win', also for 'regex' (Character)
CtrlPMode2 : 'file' or 'path', also for the local working dir (|hl-LineNr|)
CtrlPMode1 : 'file' or 'path', and the current mode (Character)
CtrlPMode2 : 'prt' or 'win', 'regex', the working directory (|hl-LineNr|)
CtrlPStats : the scanning status (Function)
For rebuilding the statuslines, see |g:ctrlp_status_func|.
@ -1083,7 +1220,7 @@ MISCELLANEOUS CONFIGS *ctrlp-miscellaneous-configs*
===============================================================================
CREDITS *ctrlp-credits*
Developed by Kien Nguyen <github.com/kien>.
Developed by Kien Nguyen <github.com/kien>. Distributed under Vim's |license|.
Project's homepage: http://kien.github.com/ctrlp.vim
Git repository: https://github.com/kien/ctrlp.vim
@ -1109,12 +1246,25 @@ Special thanks:~
* Luca Pette <github.com/lucapette>
* Seth Fowler <github.com/sfowler>
* Lowe Thiderman <github.com/thiderman>
* Christopher Fredén <github.com/icetan>
* Zahary Karadjov <github.com/zah>
* Jo De Boeck <github.com/grimpy>
===============================================================================
CHANGELOG *ctrlp-changelog*
+ New options: |g:ctrlp_open_func|.
|g:ctrlp_tabpage_position|.
Before 2012/11/30~
+ New options: |g:ctrlp_abbrev|,
|g:ctrlp_key_loop|,
|g:ctrlp_open_func|,
|g:ctrlp_tabpage_position|,
|g:ctrlp_mruf_save_on_update|
+ Rename:
*g:ctrlp_dotfiles* -> |g:ctrlp_show_hidden|.
+ Change |g:ctrlp_switch_buffer|'s and |g:ctrlp_working_path_mode|'s type
(old values still work).
+ New key for |g:ctrlp_user_command| when it's a Dictionary: 'ignore'.
Before 2012/06/15~

View File

@ -21,19 +21,17 @@ com! -n=? -com=dir CtrlP cal ctrlp#init(0, { 'dir': <q-args> })
com! -n=? -com=dir CtrlPMRUFiles cal ctrlp#init(2, { 'dir': <q-args> })
com! -bar CtrlPBuffer cal ctrlp#init(1)
com! -bar CtrlPLastMode cal ctrlp#init(-1)
com! -n=? CtrlPLastMode cal ctrlp#init(-1, { 'args': <q-args> })
com! -bar CtrlPClearCache cal ctrlp#clr()
com! -bar CtrlPClearAllCaches cal ctrlp#clra()
com! -bar CtrlPReload cal ctrlp#reset()
com! -bar ClearCtrlPCache cal ctrlp#clr()
com! -bar ClearAllCtrlPCaches cal ctrlp#clra()
com! -bar ResetCtrlP cal ctrlp#reset()
com! -bar CtrlPCurWD cal ctrlp#init(0, { 'mode': '' })
com! -bar CtrlPCurFile cal ctrlp#init(0, { 'mode': 'c' })
com! -bar CtrlPRoot cal ctrlp#init(0, { 'mode': 'rc' })
com! -bar CtrlPRoot cal ctrlp#init(0, { 'mode': 'r' })
if g:ctrlp_map != '' && !hasmapto(':<c-u>'.g:ctrlp_cmd.'<cr>', 'n')
exe 'nn <silent>' g:ctrlp_map ':<c-u>'.g:ctrlp_cmd.'<cr>'
@ -64,3 +62,5 @@ com! -bar CtrlPBookmarkDir cal ctrlp#init(ctrlp#bookmarkdir#id())
com! -n=? -com=dir CtrlPBookmarkDirAdd
\ cal ctrlp#call('ctrlp#bookmarkdir#add', <q-args>)
" vim:ts=2:sw=2:sts=2

View File

@ -23,6 +23,8 @@ Check `:help ctrlp-commands` and `:help ctrlp-extensions` for other commands.
* Press `<c-f>` and `<c-b>` to cycle between modes.
* Press `<c-d>` to switch to filename only search instead of full path.
* Press `<c-r>` to switch to regexp mode.
* Use `<c-j>`, `<c-k>` or the arrow keys to navigate the result list.
* Use `<c-t>` or `<c-v>`, `<c-x>` to open the selected entry in a new tab or in a new split.
* Use `<c-n>`, `<c-p>` to select the next/previous string in the prompt's history.
* Use `<c-y>` to create a new file and its parent directories.
* Use `<c-z>` to mark/unmark multiple files and `<c-o>` to open them.
@ -32,8 +34,7 @@ Run `:help ctrlp-mappings` or submit `?` in CtrlP for more mapping help.
* Submit two or more dots `..` to go up the directory tree by one or multiple levels.
* End the input string with a colon `:` followed by a command to execute it on the opening file(s):
Use `:25` to jump to line 25.
Use `:/any\:\ string` to jump to the first instance of `any: string`.
Use `:difft` when opening multiple files to run `:difft` on the first 4 files.
Use `:diffthis` when opening multiple files to run `:diffthis` on the first 4 files.
## Basic Options
* Change the default mapping and the default command to invoke CtrlP:
@ -46,26 +47,26 @@ Use `:difft` when opening multiple files to run `:difft` on the first 4 files.
* When invoked, unless a starting directory is specified, CtrlP will set its local working directory according to this variable:
```vim
let g:ctrlp_working_path_mode = 'rc'
let g:ctrlp_working_path_mode = 'ra'
```
`{empty-string}` - don't manage working directory.
`c` - the directory of the current file.
`r` - the nearest ancestor that contains one of these directories or files:
`.git` `.hg` `.svn` `.bzr` `_darcs`
`'c'` - the directory of the current file.
`'r'` - the nearest ancestor that contains one of these directories or files: `.git` `.hg` `.svn` `.bzr` `_darcs`
`'a'` - like c, but only if the current working directory outside of CtrlP is not a direct ancestor of the directory of the current file.
`0` or `''` (empty string) - disable this feature.
Define additional root markers with the `g:ctrlp_root_markers` option.
* Exclude files and directories using Vim's `wildignore` and CtrlP's own `g:ctrlp_custom_ignore`:
```vim
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
set wildignore+=tmp\*,*.swp,*.zip,*.exe " Windows
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe " Windows
let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$'
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git$\|\.hg$\|\.svn$',
\ 'file': '\.exe$\|\.so$\|\.dll$',
\ 'dir': '\v[\/]\.(git|hg|svn)$',
\ 'file': '\v\.(exe|so|dll)$',
\ 'link': 'some_bad_symbolic_links',
\ }
```