Some enhancements
* Add g:ctrlp_mruf_relative, an option to list only MRU files in the current working directory. Close #81. * Extend <c-y> to work with <c-z> to get a base dir to create the new file. First stab at feature #77. * Remove the hard limit for partial matching. Resolve #76. * Merge custom_statusline. Close #80. Refs Lokaltog/vim-powerline#25.
This commit is contained in:
parent
eae302f869
commit
ed2acba947
@ -2,7 +2,7 @@
|
||||
" File: autoload/ctrlp.vim
|
||||
" Description: Fuzzy file, buffer, mru and tag finder.
|
||||
" Author: Kien Nguyen <github.com/kien>
|
||||
" Version: 1.6.6
|
||||
" Version: 1.6.7
|
||||
" =============================================================================
|
||||
|
||||
" Static variables {{{1
|
||||
@ -19,14 +19,15 @@ fu! s:opts()
|
||||
\ 'g:ctrlp_extensions': ['s:extensions', []],
|
||||
\ 'g:ctrlp_follow_symlinks': ['s:folsym', 0],
|
||||
\ 'g:ctrlp_highlight_match': ['s:mathi', [1, 'Identifier']],
|
||||
\ 'g:ctrlp_lazy_update': ['s:lazy', 0],
|
||||
\ 'g:ctrlp_jump_to_buffer': ['s:jmptobuf', 2],
|
||||
\ 'g:ctrlp_lazy_update': ['s:lazy', 0],
|
||||
\ 'g:ctrlp_match_window_bottom': ['s:mwbottom', 1],
|
||||
\ 'g:ctrlp_match_window_reversed': ['s:mwreverse', 1],
|
||||
\ 'g:ctrlp_max_depth': ['s:maxdepth', 40],
|
||||
\ 'g:ctrlp_max_files': ['s:maxfiles', 20000],
|
||||
\ 'g:ctrlp_max_height': ['s:mxheight', 10],
|
||||
\ 'g:ctrlp_max_history': ['s:maxhst', hst],
|
||||
\ 'g:ctrlp_mruf_relative': ['s:relate', 0],
|
||||
\ 'g:ctrlp_open_multi': ['s:opmul', '1v'],
|
||||
\ 'g:ctrlp_open_new_file': ['s:newfop', 'v'],
|
||||
\ 'g:ctrlp_prompt_mappings': ['s:urprtmaps', 0],
|
||||
@ -164,11 +165,8 @@ fu! s:Close()
|
||||
en
|
||||
unl! s:focus s:hisidx s:hstgot s:marked s:statypes s:cline s:init s:savestr
|
||||
\ g:ctrlp_nolimit
|
||||
if exists('g:ctrlp_ext_vars')
|
||||
cal map(filter(copy(g:ctrlp_ext_vars),
|
||||
\ 'exists("v:val[4]")'), 'eval(v:val[4])')
|
||||
en
|
||||
cal ctrlp#recordhist()
|
||||
cal s:onexit()
|
||||
if exists('g:ctrlp_log') && g:ctrlp_log
|
||||
sil! redi END
|
||||
en
|
||||
@ -290,16 +288,20 @@ fu! s:MatchIt(items, pat, limit, mfunc)
|
||||
endf
|
||||
|
||||
fu! s:MatchedItems(items, pats, limit)
|
||||
let [items, pats, limit, ipt] = [a:items, a:pats, a:limit, s:ispathitem()]
|
||||
let [items, pats, limit] = [a:items, a:pats, a:limit]
|
||||
" If items is longer than s:mltipats_lim, use only the last pattern
|
||||
if len(items) >= s:mltipats_lim || ( exists('s:height') && s:height > 20 )
|
||||
let pats = [pats[-1]]
|
||||
en
|
||||
cal map(pats, 'substitute(v:val, "\\\~", "\\\\\\~", "g")')
|
||||
if !s:regexp | cal map(pats, 'escape(v:val, ".")') | en
|
||||
let mfunc = s:byfname && ipt ? 's:matchfname'
|
||||
\ : s:itemtype > 2 && len(items) < 30000 && !ipt ? 's:matchtab'
|
||||
\ : 'match'
|
||||
let [type, ipt, mfunc] = [s:type(1), s:ispathitem(), 'match']
|
||||
if s:byfname && ipt
|
||||
let mfunc = 's:matchfname'
|
||||
elsei s:itemtype > 2
|
||||
let types = { 'tabs': 's:matchtabs', 'tabe': 's:matchtabe' }
|
||||
if has_key(types, type) | let mfunc = types[type] | en
|
||||
en
|
||||
" Loop through the patterns
|
||||
for pat in pats
|
||||
" If newitems is small, set it as items to search in
|
||||
@ -651,7 +653,7 @@ endf
|
||||
fu! s:ToggleType(dir)
|
||||
let ext = exists('g:ctrlp_ext_vars') ? len(g:ctrlp_ext_vars) : 0
|
||||
let s:itemtype = s:walker(g:ctrlp_builtins + ext, s:itemtype, a:dir)
|
||||
let s:extid = s:itemtype - ( g:ctrlp_builtins + 1 )
|
||||
if s:byfname && !s:ispathitem() | let s:byfname = 0 | en
|
||||
unl! g:ctrlp_nolimit
|
||||
cal s:SetLines(s:itemtype)
|
||||
cal s:PrtSwitcher()
|
||||
@ -692,7 +694,7 @@ endf
|
||||
fu! ctrlp#acceptfile(mode, matchstr, ...)
|
||||
let [md, matchstr] = [a:mode, a:matchstr]
|
||||
" Get the full path
|
||||
let filpath = s:itemtype ? matchstr : getcwd().s:lash.matchstr
|
||||
let filpath = s:nocwd() ? getcwd().s:lash.matchstr : matchstr
|
||||
cal s:PrtExit()
|
||||
let bufnum = bufnr(filpath)
|
||||
if s:jmptobuf && bufnum > 0 && md =~ 'e\|t'
|
||||
@ -752,7 +754,7 @@ fu! s:AcceptSelection(mode)
|
||||
if empty(matchstr) | retu | en
|
||||
" Do something with it
|
||||
let actfunc = s:itemtype < 3 ? 'ctrlp#acceptfile'
|
||||
\ : g:ctrlp_ext_vars[s:itemtype - ( g:ctrlp_builtins + 1 )][1]
|
||||
\ : g:ctrlp_ext_vars[s:itemtype - ( g:ctrlp_builtins + 1 )]['accept']
|
||||
cal call(actfunc, [a:mode, matchstr])
|
||||
endf
|
||||
fu! s:CreateNewFile(...) "{{{1
|
||||
@ -766,12 +768,19 @@ fu! s:CreateNewFile(...) "{{{1
|
||||
let str = s:sanstail(str)
|
||||
let arr = split(str, '[\/]')
|
||||
let fname = remove(arr, -1)
|
||||
if len(arr) | if isdirectory(s:createparentdirs(arr))
|
||||
let optyp = str
|
||||
en | el
|
||||
let optyp = fname
|
||||
if exists('s:marked') && len(s:marked)
|
||||
" Use the first marked file's path
|
||||
let val = values(s:marked)[0]
|
||||
let mrk = ctrlp#rmbasedir([val])[0]
|
||||
if val != mrk
|
||||
let arr = extend(split(mrk, '[\/]')[:-2], arr)
|
||||
let str = ctrlp#rmbasedir([fnamemodify(val, ':p:h').s:lash.str])[0]
|
||||
en
|
||||
if exists('optyp')
|
||||
en
|
||||
if len(arr) | if isdirectory(s:createparentdirs(arr))
|
||||
let optyp = str | en | el | let optyp = fname
|
||||
en
|
||||
if !exists('optyp') | retu | en
|
||||
let filpath = getcwd().s:lash.optyp
|
||||
cal s:insertcache(str)
|
||||
cal s:PrtExit()
|
||||
@ -781,7 +790,6 @@ fu! s:CreateNewFile(...) "{{{1
|
||||
\ s:newfop =~ '3\|v' || ( a:0 && a:1 == 'v' ) || md == 'v' ? 'vne' :
|
||||
\ ctrlp#normcmd('e')
|
||||
cal s:openfile(cmd, filpath)
|
||||
en
|
||||
endf
|
||||
" * OpenMulti() {{{1
|
||||
fu! s:MarkToOpen()
|
||||
@ -791,7 +799,7 @@ fu! s:MarkToOpen()
|
||||
en
|
||||
let matchstr = matchstr(getline('.'), '^> \zs.\+\ze\t*$')
|
||||
if empty(matchstr) | retu | en
|
||||
let filpath = s:itemtype ? matchstr : getcwd().s:lash.matchstr
|
||||
let filpath = s:nocwd() ? getcwd().s:lash.matchstr : matchstr
|
||||
if exists('s:marked') && s:dictindex(s:marked, filpath) > 0
|
||||
" Unmark and remove the file from s:marked
|
||||
let key = s:dictindex(s:marked, filpath)
|
||||
@ -913,7 +921,8 @@ fu! ctrlp#statusline()
|
||||
\ ['mru files', 'mru'],
|
||||
\ ]
|
||||
if exists('g:ctrlp_ext_vars')
|
||||
cal map(copy(g:ctrlp_ext_vars), 'add(s:statypes, [ v:val[2], v:val[3] ])')
|
||||
cal map(copy(g:ctrlp_ext_vars),
|
||||
\ 'add(s:statypes, [ v:val["lname"], v:val["sname"] ])')
|
||||
en
|
||||
en
|
||||
let tps = s:statypes
|
||||
@ -927,7 +936,7 @@ fu! ctrlp#statusline()
|
||||
\ exists('s:marked') ? ' <'.s:dismrk().'>' : ' <+>' : ''
|
||||
if has_key(s:status, 'main')
|
||||
let args = [focus, byfname, s:regexp, prv, item, nxt, marked]
|
||||
let &l:stl = call(s:status.main, args)
|
||||
let &l:stl = call(s:status['main'], args)
|
||||
el
|
||||
let item = '%#Character# '.item.' %*'
|
||||
let focus = '%#LineNr# '.focus.' %*'
|
||||
@ -944,17 +953,17 @@ fu! s:dismrk()
|
||||
\ '%<'.join(values(map(copy(s:marked), 'split(v:val, "[\\/]")[-1]')), ', ')
|
||||
endf
|
||||
|
||||
fu! ctrlp#progress(len)
|
||||
fu! ctrlp#progress(enum)
|
||||
if has('macunix') || has('mac') | sl 1m | en
|
||||
let &l:stl = has_key(s:status, 'prog') ? call(s:status.prog, [a:len])
|
||||
\ : '%#Function# '.a:len.' %* %=%<%#LineNr# '.getcwd().' %*'
|
||||
let &l:stl = has_key(s:status, 'prog') ? call(s:status['prog'], [a:enum])
|
||||
\ : '%#Function# '.a:enum.' %* %=%<%#LineNr# '.getcwd().' %*'
|
||||
redr
|
||||
endf
|
||||
" Paths {{{2
|
||||
fu! s:ispathitem()
|
||||
let ext = s:itemtype - ( g:ctrlp_builtins + 1 )
|
||||
retu s:itemtype < 3
|
||||
\ || ( s:itemtype > 2 && g:ctrlp_ext_vars[ext][3] =~ 'dir\|rts' )
|
||||
\ || ( s:itemtype > 2 && g:ctrlp_ext_vars[ext]['type'] == 'path' )
|
||||
endf
|
||||
|
||||
fu! ctrlp#dirnfile(entries)
|
||||
@ -996,7 +1005,7 @@ endf
|
||||
|
||||
fu! ctrlp#rmbasedir(items)
|
||||
let cwd = getcwd()
|
||||
if !stridx(a:items[0], cwd)
|
||||
if a:items != [] && !stridx(a:items[0], cwd)
|
||||
let idx = strlen(cwd) + 1
|
||||
retu map(a:items, 'strpart(v:val, idx)')
|
||||
en
|
||||
@ -1066,7 +1075,7 @@ endf
|
||||
|
||||
fu! s:highlight(pat, grp)
|
||||
cal clearmatches()
|
||||
if !empty(a:pat) && s:itemtype < 3
|
||||
if !empty(a:pat) && s:ispathitem()
|
||||
let pat = substitute(a:pat, '\~', '\\~', 'g')
|
||||
if !s:regexp | let pat = escape(pat, '.') | en
|
||||
" Match only filename
|
||||
@ -1319,6 +1328,10 @@ fu! ctrlp#j2l(nr)
|
||||
sil! norm! zvzz
|
||||
endf
|
||||
|
||||
fu! s:nocwd()
|
||||
retu !s:itemtype || ( s:itemtype == 2 && s:relate )
|
||||
endf
|
||||
|
||||
fu! s:regexfilter(str)
|
||||
let str = a:str
|
||||
for key in keys(s:fpats) | if match(str, key) >= 0
|
||||
@ -1335,10 +1348,14 @@ fu! s:matchfname(item, pat)
|
||||
retu match(split(a:item, s:lash)[-1], a:pat)
|
||||
endf
|
||||
|
||||
fu! s:matchtab(item, pat)
|
||||
fu! s:matchtabs(item, pat)
|
||||
retu match(split(a:item, '\t\+')[0], a:pat)
|
||||
endf
|
||||
|
||||
fu! s:matchtabe(item, pat)
|
||||
retu match(split(a:item, '\t\+[^\t]\+$')[0], a:pat)
|
||||
endf
|
||||
|
||||
fu! s:maxf(len)
|
||||
retu s:maxfiles && a:len > s:maxfiles ? 1 : 0
|
||||
endf
|
||||
@ -1360,15 +1377,22 @@ fu! s:insertcache(str)
|
||||
cal s:writecache(0, ctrlp#utils#cachefile())
|
||||
endf
|
||||
" Extensions {{{2
|
||||
fu! s:type()
|
||||
retu s:itemtype > 2 ?
|
||||
\ g:ctrlp_ext_vars[s:itemtype - ( g:ctrlp_builtins + 1 )][3] : s:itemtype
|
||||
fu! s:type(...)
|
||||
let ext = s:itemtype - ( g:ctrlp_builtins + 1 )
|
||||
retu s:itemtype > 2 ? g:ctrlp_ext_vars[ext][a:0 ? 'type' : 'sname'] : s:itemtype
|
||||
endf
|
||||
|
||||
fu! s:tagfiles()
|
||||
retu filter(map(tagfiles(), 'fnamemodify(v:val, ":p")'), 'filereadable(v:val)')
|
||||
endf
|
||||
|
||||
fu! s:onexit()
|
||||
if exists('g:ctrlp_ext_vars')
|
||||
cal map(filter(copy(g:ctrlp_ext_vars),
|
||||
\ 'has_key(v:val, "exit")'), 'eval(v:val["exit"])')
|
||||
en
|
||||
endf
|
||||
|
||||
fu! ctrlp#allbufs()
|
||||
let bufs = []
|
||||
for each in range(1, bufnr('$'))
|
||||
@ -1404,7 +1428,7 @@ fu! s:SetLines(type)
|
||||
\ 'ctrlp#mrufiles#list(-1)',
|
||||
\ ]
|
||||
if exists('g:ctrlp_ext_vars')
|
||||
cal map(copy(g:ctrlp_ext_vars), 'add(types, v:val[0])')
|
||||
cal map(copy(g:ctrlp_ext_vars), 'add(types, v:val["init"])')
|
||||
en
|
||||
let g:ctrlp_lines = eval(types[a:type])
|
||||
endf
|
||||
|
@ -13,8 +13,14 @@ if exists('g:loaded_ctrlp_buftag') && g:loaded_ctrlp_buftag
|
||||
en
|
||||
let g:loaded_ctrlp_buftag = 1
|
||||
|
||||
let s:buftag_var = ['ctrlp#buffertag#init(s:crfile)', 'ctrlp#buffertag#accept',
|
||||
\ 'buffer tags', 'bft', 'ctrlp#buffertag#exit()']
|
||||
let s:buftag_var = {
|
||||
\ 'init': 'ctrlp#buffertag#init(s:crfile)',
|
||||
\ 'accept': 'ctrlp#buffertag#accept',
|
||||
\ 'lname': 'buffer tags',
|
||||
\ 'sname': 'bft',
|
||||
\ 'exit': 'ctrlp#buffertag#exit()',
|
||||
\ 'type': 'tabs',
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:buftag_var) : [s:buftag_var]
|
||||
|
@ -17,8 +17,13 @@ let s:ars = [
|
||||
\ 's:glob',
|
||||
\ ]
|
||||
|
||||
let s:dir_var = ['ctrlp#dir#init('.join(s:ars, ', ').')', 'ctrlp#dir#accept',
|
||||
\ 'dirs', 'dir']
|
||||
let s:dir_var = {
|
||||
\ 'init': 'ctrlp#dir#init('.join(s:ars, ', ').')',
|
||||
\ 'accept': 'ctrlp#dir#accept',
|
||||
\ 'lname': 'dirs',
|
||||
\ 'sname': 'dir',
|
||||
\ 'type': 'path',
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:dir_var) : [s:dir_var]
|
||||
@ -45,8 +50,8 @@ fu! ctrlp#dir#init(...)
|
||||
for each in range(len(s:ars))
|
||||
exe 'let' s:ars[each] '=' string(eval('a:'.(each + 1)))
|
||||
endfo
|
||||
let cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().s:dir_var[3]
|
||||
let cafile = cadir.ctrlp#utils#lash().ctrlp#utils#cachefile(s:dir_var[3])
|
||||
let cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().s:dir_var['sname']
|
||||
let cafile = cadir.ctrlp#utils#lash().ctrlp#utils#cachefile(s:dir_var['sname'])
|
||||
if g:ctrlp_newdir || !filereadable(cafile)
|
||||
let g:ctrlp_alldirs = []
|
||||
cal s:globdirs(s:cwd, 0)
|
||||
|
@ -17,7 +17,13 @@ if exists('g:loaded_ctrlp_line') && g:loaded_ctrlp_line
|
||||
en
|
||||
let g:loaded_ctrlp_line = 1
|
||||
|
||||
let s:line_var = ['ctrlp#line#init()', 'ctrlp#line#accept', 'lines', 'lns']
|
||||
let s:line_var = {
|
||||
\ 'init': 'ctrlp#line#init()',
|
||||
\ 'accept': 'ctrlp#line#accept',
|
||||
\ 'lname': 'lines',
|
||||
\ 'sname': 'lns',
|
||||
\ 'type': 'tabe',
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:line_var) : [s:line_var]
|
||||
|
@ -11,6 +11,7 @@ fu! ctrlp#mrufiles#opts()
|
||||
\ 'g:ctrlp_mruf_include': ['s:include', ''],
|
||||
\ 'g:ctrlp_mruf_exclude': ['s:exclude', ''],
|
||||
\ 'g:ctrlp_mruf_case_sensitive': ['s:csen', 1],
|
||||
\ 'g:ctrlp_mruf_relative': ['s:relate', 0],
|
||||
\ }
|
||||
for [ke, va] in items(opts)
|
||||
exe 'let' va[0] '=' string(exists(ke) ? eval(ke) : va[1])
|
||||
@ -47,8 +48,14 @@ fu! ctrlp#mrufiles#list(bufnr, ...) "{{{1
|
||||
en
|
||||
" Return the list with the active buffer removed
|
||||
if bufnr == -1
|
||||
let crfile = fnamemodify(bufname(winbufnr(winnr('#'))), ':p')
|
||||
retu empty(crfile) ? mrufs : filter(mrufs, 'v:val !='.s:csen.' crfile')
|
||||
let crf = fnamemodify(bufname(winbufnr(winnr('#'))), ':p')
|
||||
let mrufs = empty(crf) ? mrufs : filter(mrufs, 'v:val !='.s:csen.' crf')
|
||||
if s:relate
|
||||
let cwd = getcwd()
|
||||
cal filter(mrufs, '!stridx(v:val, cwd)')
|
||||
cal ctrlp#rmbasedir(mrufs)
|
||||
en
|
||||
retu mrufs
|
||||
en
|
||||
" Remove old entry
|
||||
cal filter(mrufs, 'v:val !='.s:csen.' filename')
|
||||
|
@ -10,8 +10,13 @@ if exists('g:loaded_ctrlp_quickfix') && g:loaded_ctrlp_quickfix
|
||||
en
|
||||
let g:loaded_ctrlp_quickfix = 1
|
||||
|
||||
let s:var_qf = ['ctrlp#quickfix#init()', 'ctrlp#quickfix#accept', 'quickfix',
|
||||
\ 'qfx']
|
||||
let s:var_qf = {
|
||||
\ 'init': 'ctrlp#quickfix#init()',
|
||||
\ 'accept': 'ctrlp#quickfix#accept',
|
||||
\ 'lname': 'quickfix',
|
||||
\ 'sname': 'qfx',
|
||||
\ 'type': 'line',
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:var_qf) : [s:var_qf]
|
||||
|
@ -1,24 +1,22 @@
|
||||
" =============================================================================
|
||||
" File: autoload/ctrlp/rtscript.vim
|
||||
" Description: Runtime scripts extension - Find vimscripts in runtimepath
|
||||
" Description: Runtime scripts extension
|
||||
" Author: Kien Nguyen <github.com/kien>
|
||||
" =============================================================================
|
||||
|
||||
" User Configuration {{{1
|
||||
" Enable:
|
||||
" let g:ctrlp_extensions += ['rtscript']
|
||||
" Create A Command:
|
||||
" com! CtrlPRTS cal ctrlp#init(ctrlp#rtscript#id())
|
||||
"}}}
|
||||
|
||||
" Init {{{1
|
||||
if exists('g:loaded_ctrlp_rtscript') && g:loaded_ctrlp_rtscript
|
||||
fini
|
||||
en
|
||||
let [g:loaded_ctrlp_rtscript, g:ctrlp_newrts] = [1, 0]
|
||||
|
||||
let s:rtscript_var = ['ctrlp#rtscript#init()', 'ctrlp#rtscript#accept',
|
||||
\ 'runtime scripts', 'rts']
|
||||
let s:rtscript_var = {
|
||||
\ 'init': 'ctrlp#rtscript#init()',
|
||||
\ 'accept': 'ctrlp#rtscript#accept',
|
||||
\ 'lname': 'runtime scripts',
|
||||
\ 'sname': 'rts',
|
||||
\ 'type': 'path',
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:rtscript_var) : [s:rtscript_var]
|
||||
@ -27,6 +25,7 @@ let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
" Public {{{1
|
||||
fu! ctrlp#rtscript#init()
|
||||
if g:ctrlp_newrts || !exists('g:ctrlp_rtscache')
|
||||
sil! cal ctrlp#progress('Indexing...')
|
||||
let entries = split(globpath(&rtp, '**/*.\(vim\|txt\)'), "\n")
|
||||
let [g:ctrlp_rtscache, g:ctrlp_newrts] = [ctrlp#dirnfile(entries)[1], 0]
|
||||
en
|
||||
|
@ -10,8 +10,13 @@ if exists('g:loaded_ctrlp_tag') && g:loaded_ctrlp_tag
|
||||
en
|
||||
let g:loaded_ctrlp_tag = 1
|
||||
|
||||
let s:tag_var = ['ctrlp#tag#init(s:tagfiles)', 'ctrlp#tag#accept',
|
||||
\ 'tags', 'tag']
|
||||
let s:tag_var = {
|
||||
\ 'init': 'ctrlp#tag#init(s:tagfiles)',
|
||||
\ 'accept': 'ctrlp#tag#accept',
|
||||
\ 'lname': 'tags',
|
||||
\ 'sname': 'tag',
|
||||
\ 'type': 'tabs',
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:tag_var) : [s:tag_var]
|
||||
|
@ -18,8 +18,13 @@ if ( exists('g:loaded_ctrlp_undo') && g:loaded_ctrlp_undo )
|
||||
en
|
||||
let g:loaded_ctrlp_undo = 1
|
||||
|
||||
let s:undo_var = ['ctrlp#undo#init(s:undotree)', 'ctrlp#undo#accept',
|
||||
\ 'undo', 'udo']
|
||||
let s:undo_var = {
|
||||
\ 'init': 'ctrlp#undo#init(s:undotree)',
|
||||
\ 'accept': 'ctrlp#undo#accept',
|
||||
\ 'lname': 'undo',
|
||||
\ 'sname': 'udo',
|
||||
\ 'type': 'line',
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:undo_var) : [s:undo_var]
|
||||
|
@ -1,4 +1,4 @@
|
||||
*ctrlp.txt* Fuzzy file, buffer, mru and tag finder. v1.6.6
|
||||
*ctrlp.txt* Fuzzy file, buffer, mru and tag finder. v1.6.7
|
||||
*CtrlP* *ControlP* *'ctrlp'* *'ctrl-p'*
|
||||
===============================================================================
|
||||
# #
|
||||
@ -195,6 +195,11 @@ 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: >
|
||||
@ -227,7 +232,7 @@ Examples: >
|
||||
let g:ctrlp_custom_ignore = {
|
||||
\ 'dir': '\.git$\|\.hg$\|\.svn$',
|
||||
\ 'file': '\.exe$\|\.so$\|\.dll$',
|
||||
\ 'link': 'bad_symbolic_link',
|
||||
\ 'link': 'some$\|bad$\|symbolic$\|links$',
|
||||
\ }
|
||||
>
|
||||
|
||||
@ -355,13 +360,13 @@ works in |regexp| mode. To split the pattern, separate words with space: >
|
||||
<
|
||||
|
||||
*'g:ctrlp_status_func'*
|
||||
Use this to set custom statuslines for the |CtrlP| window: >
|
||||
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',
|
||||
\ 'main': 'Function_Name_1',
|
||||
\ 'prog': 'Function_Name_2',
|
||||
\ }
|
||||
<
|
||||
See https://gist.github.com/1610859 for a working example.
|
||||
@ -396,7 +401,7 @@ See https://gist.github.com/1610859 for a working example.
|
||||
|
||||
*:ResetCtrlP*
|
||||
:ResetCtrlP
|
||||
Reset all options, take in new values of the option variables in section 2.
|
||||
Reset all options and take in new values of the option variables.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
The following commands ignore the current value of |g:ctrlp_working_path_mode|:
|
||||
@ -423,7 +428,7 @@ Once inside the prompt:~
|
||||
Toggle between the string mode (section 5.a & b) and full |regexp| mode.
|
||||
(note: in full |regexp| mode, the prompt’s base is 'r>>' instead of '>>>')
|
||||
|
||||
See also |input-formats| and |g:ctrlp_regexp_search|.
|
||||
See also |input-formats| (guide) and |g:ctrlp_regexp_search| (option).
|
||||
|
||||
<c-d>
|
||||
Toggle between full path search and filename only search.
|
||||
@ -500,7 +505,8 @@ Once inside the prompt:~
|
||||
Previous string in the prompt’s history
|
||||
|
||||
<c-z>
|
||||
Mark/unmark a file to be opened with <c-o>.
|
||||
- Mark/unmark a file to be opened with <c-o>.
|
||||
- Mark/unmark a file to create a new file in the same directory with <c-y>.
|
||||
|
||||
<c-o>
|
||||
Open files marked by <c-z>.
|
||||
@ -546,7 +552,7 @@ c) End the string with a colon ':' followed by a Vim command to execute that
|
||||
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\:function' will open the selected file and jump to the first
|
||||
'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.
|
||||
@ -563,9 +569,14 @@ e) Similarly, submit '/' or '\' to find and go to the project’s 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.
|
||||
e.g. 'parentdir/file.txt' will create a directory named 'parentdir' as well
|
||||
as 'file.txt'.
|
||||
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.
|
||||
@ -575,7 +586,7 @@ g) Submit ? to open this help file.
|
||||
|
||||
Extensions are optional. To enable an extension, add its name to the variable
|
||||
g:ctrlp_extensions: >
|
||||
let g:ctrlp_extensions = ['tag', 'buffertag', 'quickfix', 'dir']
|
||||
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>.
|
||||
@ -617,6 +628,12 @@ Available extensions:~
|
||||
+ <c-x> change the global working directory to |CtrlP|’s current local
|
||||
working directory (exit).
|
||||
|
||||
*:CtrlPRTS*
|
||||
* Runtime script mode:~
|
||||
- Name: 'rts'
|
||||
- Command: ':CtrlPRTS'
|
||||
- Search for vimscripts in runtimepath.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Buffer Tag mode options:~
|
||||
|
||||
@ -719,10 +736,11 @@ Special thanks:~
|
||||
===============================================================================
|
||||
CHANGELOG *ctrlp-changelog*
|
||||
|
||||
Before 2012/01/14~
|
||||
Before 2012/01/15~
|
||||
|
||||
+ 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.
|
||||
|
||||
|
@ -55,4 +55,8 @@ if index(s:ext, 'buffertag') >= 0
|
||||
com! CtrlPBufTagAll cal ctrlp#init(ctrlp#buffertag#cmd(1))
|
||||
en
|
||||
|
||||
if index(s:ext, 'rts') >= 0
|
||||
com! CtrlPRTS cal ctrlp#init(ctrlp#rtscript#id())
|
||||
en
|
||||
|
||||
unl s:ext
|
||||
|
Loading…
x
Reference in New Issue
Block a user