mirror of
https://github.com/gryf/.vim.git
synced 2026-02-08 11:15:47 +01:00
Update of plugins: mark, ctrlp, taglisttoo and syntastic
This commit is contained in:
@@ -14,6 +14,7 @@ fu! s:opts()
|
||||
\ 'g:ctrlp_by_filename': ['s:byfname', 0],
|
||||
\ 'g:ctrlp_clear_cache_on_exit': ['s:clrex', 1],
|
||||
\ 'g:ctrlp_custom_ignore': ['s:usrign', ''],
|
||||
\ 'g:ctrlp_default_input': ['s:deftxt', 0],
|
||||
\ 'g:ctrlp_dont_split': ['s:nosplit', 'netrw'],
|
||||
\ 'g:ctrlp_dotfiles': ['s:dotfiles', 1],
|
||||
\ 'g:ctrlp_extensions': ['s:extensions', []],
|
||||
@@ -58,7 +59,6 @@ fu! s:opts()
|
||||
let s:glob = s:dotfiles ? '.*\|*' : '*'
|
||||
let s:igntype = empty(s:usrign) ? -1 : type(s:usrign)
|
||||
" Extensions
|
||||
let g:ctrlp_builtins = 2
|
||||
for each in s:extensions
|
||||
exe 'ru autoload/ctrlp/'.each.'.vim'
|
||||
endfo
|
||||
@@ -173,6 +173,7 @@ let s:hlgrps = {
|
||||
fu! s:Open()
|
||||
cal s:log(1)
|
||||
cal s:getenv()
|
||||
cal s:execextvar('enter')
|
||||
sil! exe 'noa keepa' ( s:mwbottom ? 'bo' : 'to' ) '1new ControlP'
|
||||
let [s:bufnr, s:prompt, s:winw] = [bufnr('%'), ['', '', ''], winwidth(0)]
|
||||
abc <buffer>
|
||||
@@ -204,7 +205,7 @@ fu! s:Close()
|
||||
unl! s:focus s:hisidx s:hstgot s:marked s:statypes s:cline s:init s:savestr
|
||||
\ g:ctrlp_nolimit
|
||||
cal ctrlp#recordhist()
|
||||
cal s:extvar('exit')
|
||||
cal s:execextvar('exit')
|
||||
cal s:log(0)
|
||||
ec
|
||||
endf
|
||||
@@ -228,7 +229,7 @@ fu! ctrlp#reset()
|
||||
cal s:autocmds()
|
||||
cal ctrlp#utils#opts()
|
||||
cal ctrlp#mrufiles#opts()
|
||||
cal s:extvar('opts')
|
||||
cal s:execextvar('opts')
|
||||
endf
|
||||
" * Files {{{1
|
||||
fu! ctrlp#files()
|
||||
@@ -318,16 +319,15 @@ fu! ctrlp#buffers()
|
||||
endf
|
||||
" * MatchedItems() {{{1
|
||||
fu! s:MatchIt(items, pat, limit, mfunc, ipt, exc)
|
||||
let [newitems, id, itlen] = [[], 0, len(a:items)]
|
||||
wh id < itlen
|
||||
let item = a:items[id]
|
||||
let [newitems, id] = [[], 0]
|
||||
for item in a:items
|
||||
let id += 1
|
||||
try | if !( a:ipt && item == a:exc ) && call(a:mfunc, [item, a:pat]) >= 0
|
||||
cal add(newitems, item)
|
||||
en | cat | brea | endt
|
||||
if a:limit > 0 && len(newitems) >= a:limit | brea | en
|
||||
endw
|
||||
let s:mdata = [s:dyncwd, s:itemtype, s:regexp, a:items[(id):]]
|
||||
endfo
|
||||
let s:mdata = [s:dyncwd, s:itemtype, s:regexp, s:sublist(a:items, id, -1)]
|
||||
retu newitems
|
||||
endf
|
||||
|
||||
@@ -387,21 +387,22 @@ fu! s:Render(lines, pat, ipt)
|
||||
sil! exe '%d _ | res' s:height
|
||||
" Print the new items
|
||||
if empty(lines)
|
||||
let s:matched = []
|
||||
let [s:matched, s:lines] = [[], []]
|
||||
cal setline(1, ' == NO ENTRIES ==')
|
||||
setl noma nocul
|
||||
cal s:unmarksigns()
|
||||
if s:dohighlight() | cal clearmatches() | en
|
||||
retu
|
||||
en
|
||||
if ( ( s:itemtype != 2 && !exists('g:ctrlp_nolimit') )
|
||||
\ || s:prompt != ['', '', ''] ) && s:matcher == {}
|
||||
" Sorting
|
||||
if s:dosort()
|
||||
let s:compat = a:pat
|
||||
cal sort(lines, 's:mixedsort')
|
||||
unl s:compat
|
||||
en
|
||||
if s:mwreverse | cal reverse(lines) | en
|
||||
let s:matched = copy(lines)
|
||||
if s:mwreverse | cal reverse(lines) | en
|
||||
let s:lines = copy(lines)
|
||||
cal map(lines, 's:formatline(v:val, a:ipt)')
|
||||
cal setline(1, lines)
|
||||
setl noma cul
|
||||
@@ -463,6 +464,17 @@ fu! s:BuildPrompt(upd, ...)
|
||||
exe 'echoh' hibase '| echon "_" | echoh None'
|
||||
en
|
||||
endf
|
||||
" - SetDefTxt() {{{1
|
||||
fu! s:SetDefTxt()
|
||||
if s:deftxt == '0' || s:pathmode == 1 | retu | en
|
||||
let txt = s:deftxt
|
||||
if !type(txt)
|
||||
let txt = txt && !stridx(s:crfpath, s:dyncwd)
|
||||
\ ? ctrlp#rmbasedir([s:crfpath])[0] : ''
|
||||
let txt = txt != '' ? txt.s:lash(s:crfpath) : ''
|
||||
en
|
||||
let s:prompt[0] = txt
|
||||
endf
|
||||
" ** Prt Actions {{{1
|
||||
" Editing {{{2
|
||||
fu! s:PrtClear()
|
||||
@@ -506,16 +518,20 @@ endf
|
||||
|
||||
fu! s:PrtInsert(type)
|
||||
unl! s:hstgot
|
||||
let s:act_add = 1
|
||||
let s:prompt[0] .= a:type == 'w' ? s:crword
|
||||
\ : a:type == 's' ? getreg('/')
|
||||
\ : a:type == 'v' ? s:crvisual
|
||||
\ : a:type == '+' ? substitute(getreg('+'), '\n', '\\n', 'g') : s:prompt[0]
|
||||
cal s:BuildPrompt(1)
|
||||
unl s:act_add
|
||||
endf
|
||||
|
||||
fu! s:PrtExpandDir()
|
||||
let prt = s:prompt
|
||||
if prt[0] == '' | retu | en
|
||||
unl! s:hstgot
|
||||
let s:act_add = 1
|
||||
let [base, seed] = s:headntail(prt[0])
|
||||
let dirs = s:dircompl(base, seed)
|
||||
if len(dirs) == 1
|
||||
@@ -524,6 +540,7 @@ fu! s:PrtExpandDir()
|
||||
let prt[0] .= s:findcommon(dirs, prt[0])
|
||||
en
|
||||
cal s:BuildPrompt(1)
|
||||
unl s:act_add
|
||||
endf
|
||||
" Movement {{{2
|
||||
fu! s:PrtCurLeft()
|
||||
@@ -562,7 +579,7 @@ fu! s:PrtSelectMove(dir)
|
||||
endf
|
||||
|
||||
fu! s:PrtSelectJump(char, ...)
|
||||
let lines = copy(s:matched)
|
||||
let lines = copy(s:lines)
|
||||
if a:0
|
||||
cal map(lines, 'split(v:val, ''[\/]\ze[^\/]\+$'')[-1]')
|
||||
en
|
||||
@@ -804,7 +821,7 @@ fu! s:AcceptSelection(mode)
|
||||
let str = join(s:prompt, '')
|
||||
if a:mode == 'e' | if s:SpecInputs(str) | retu | en | en
|
||||
" Get the selected line
|
||||
let line = !empty(s:matched) ? s:matched[line('.') - 1] : ''
|
||||
let line = !empty(s:lines) ? s:lines[line('.') - 1] : ''
|
||||
if a:mode != 'e' && s:itemtype < 3 && line == ''
|
||||
\ && str !~ '\v^(\.\.|/|\\|\?)$'
|
||||
cal s:CreateNewFile(a:mode) | retu
|
||||
@@ -852,7 +869,7 @@ fu! s:MarkToOpen()
|
||||
if s:bufnr <= 0 || s:opmul == '0' || ( s:itemtype > 2 && s:type() !~ 'rts' )
|
||||
retu
|
||||
en
|
||||
let line = !empty(s:matched) ? s:matched[line('.') - 1] : ''
|
||||
let line = !empty(s:lines) ? s:lines[line('.') - 1] : ''
|
||||
if empty(line) | retu | en
|
||||
let filpath = fnamemodify(line, ':p')
|
||||
if exists('s:marked') && s:dictindex(s:marked, filpath) > 0
|
||||
@@ -1260,8 +1277,8 @@ endf
|
||||
|
||||
fu! s:remarksigns()
|
||||
if !s:dosigns() | retu | en
|
||||
for ic in range(1, len(s:matched))
|
||||
let key = s:dictindex(s:marked, fnamemodify(s:matched[ic - 1], ':p'))
|
||||
for ic in range(1, len(s:lines))
|
||||
let key = s:dictindex(s:marked, fnamemodify(s:lines[ic - 1], ':p'))
|
||||
if key > 0
|
||||
exe 'sign place' key 'line='.ic.' name=ctrlpmark buffer='.s:bufnr
|
||||
en
|
||||
@@ -1271,7 +1288,7 @@ endf
|
||||
fu! s:dosigns()
|
||||
retu exists('s:marked') && s:bufnr > 0 && s:opmul != '0' && has('signs')
|
||||
endf
|
||||
" Dictionaries {{{2
|
||||
" Lists & Dictionaries {{{2
|
||||
fu! s:dictindex(dict, expr)
|
||||
for key in keys(a:dict)
|
||||
if a:dict[key] == a:expr | retu key | en
|
||||
@@ -1282,6 +1299,10 @@ endf
|
||||
fu! s:vacantdict(dict)
|
||||
retu filter(range(1, max(keys(a:dict))), '!has_key(a:dict, v:val)')
|
||||
endf
|
||||
|
||||
fu! s:sublist(l, s, e)
|
||||
retu v:version > 701 ? a:l[(a:s):(a:e)] : remove(copy(a:l), a:s, a:e)
|
||||
endf
|
||||
" Buffers {{{2
|
||||
fu! s:buftab(bufnr, md)
|
||||
for tabnr in range(1, tabpagenr('$'))
|
||||
@@ -1374,66 +1395,17 @@ fu! s:argmaps(md, ...)
|
||||
retu a:md
|
||||
endf
|
||||
" Misc {{{2
|
||||
fu! s:dosort()
|
||||
retu s:matcher == {} && ( ( s:itemtype != 2 && !exists('g:ctrlp_nolimit') )
|
||||
\ || s:prompt != ['', '', ''] ) && s:getextvar('sort')
|
||||
endf
|
||||
|
||||
fu! s:narrowable()
|
||||
retu exists('s:act_add') && exists('s:matched') && s:matched != []
|
||||
\ && exists('s:mdata') && s:mdata[:2] == [s:dyncwd, s:itemtype, s:regexp]
|
||||
\ && s:matcher == {}
|
||||
endf
|
||||
|
||||
fu! s:matargs(mfunc, str)
|
||||
let match_type = {
|
||||
\ 'match': 'full-line',
|
||||
\ 's:matchfname': 'filename-only',
|
||||
\ 's:matchtabs': 'first-non-tab',
|
||||
\ 's:matchtabe': 'until-last-tab',
|
||||
\ }
|
||||
retu [s:matcher['match'], a:str, match_type[a:mfunc]]
|
||||
endf
|
||||
|
||||
fu! s:log(m)
|
||||
if exists('g:ctrlp_log') && g:ctrlp_log | if a:m
|
||||
let cadir = ctrlp#utils#cachedir()
|
||||
sil! exe 'redi! >' cadir.s:lash(cadir).'ctrlp.log'
|
||||
el
|
||||
sil! redi END
|
||||
en | en
|
||||
endf
|
||||
|
||||
fu! s:strwidth(str)
|
||||
retu exists('*strdisplaywidth') ? strdisplaywidth(a:str) : strlen(a:str)
|
||||
endf
|
||||
|
||||
fu! s:getenv()
|
||||
let [s:cwd, s:winres] = [getcwd(), [winrestcmd(), &lines, winnr('$')]]
|
||||
let [s:crfile, s:crfpath] = [expand('%:p', 1), expand('%:p:h', 1)]
|
||||
let [s:crword, s:crline] = [expand('<cword>'), getline('.')]
|
||||
let [s:winh, s:crcursor] = [min([s:mxheight, &lines]), getpos('.')]
|
||||
let [s:crbufnr, s:crvisual] = [bufnr('%'), s:lastvisual()]
|
||||
let s:currwin = s:mwbottom ? winnr() : winnr() + has('autocmd')
|
||||
let s:wpmode = exists('b:ctrlp_working_path_mode')
|
||||
\ ? b:ctrlp_working_path_mode : s:pathmode
|
||||
if exists('g:ctrlp_extensions')
|
||||
if index(g:ctrlp_extensions, 'undo') >= 0
|
||||
let s:undos = s:getundo()
|
||||
en
|
||||
if index(g:ctrlp_extensions, 'tag') >= 0
|
||||
let s:tagfiles = s:tagfiles()
|
||||
en
|
||||
en
|
||||
endf
|
||||
|
||||
fu! s:lastvisual()
|
||||
let cview = winsaveview()
|
||||
let [ovreg, ovtype] = [getreg('v'), getregtype('v')]
|
||||
let [oureg, outype] = [getreg('"'), getregtype('"')]
|
||||
sil! norm! gv"vy
|
||||
let selected = substitute(getreg('v'), '\n', '\\n', 'g')
|
||||
cal setreg('v', ovreg, ovtype)
|
||||
cal setreg('"', oureg, outype)
|
||||
cal winrestview(cview)
|
||||
retu selected
|
||||
endf
|
||||
|
||||
fu! s:migemo(str)
|
||||
let str = a:str
|
||||
let dict = s:glbpath(&rtp, printf("dict/%s/migemo-dict", &enc), 1)
|
||||
@@ -1450,6 +1422,73 @@ fu! s:migemo(str)
|
||||
retu str
|
||||
endf
|
||||
|
||||
fu! s:strwidth(str)
|
||||
retu exists('*strdisplaywidth') ? strdisplaywidth(a:str) : strlen(a:str)
|
||||
endf
|
||||
|
||||
fu! ctrlp#j2l(nr)
|
||||
exe a:nr
|
||||
sil! norm! zvzz
|
||||
endf
|
||||
|
||||
fu! s:maxf(len)
|
||||
retu s:maxfiles && a:len > s:maxfiles ? 1 : 0
|
||||
endf
|
||||
|
||||
fu! s:regexfilter(str)
|
||||
let str = a:str
|
||||
for key in keys(s:fpats) | if match(str, key) >= 0
|
||||
let str = substitute(str, s:fpats[key], '', 'g')
|
||||
en | endfo
|
||||
retu str
|
||||
endf
|
||||
|
||||
fu! s:walker(m, p, d)
|
||||
retu a:d > 0 ? a:p < a:m ? a:p + a:d : 0 : a:p > 0 ? a:p + a:d : a:m
|
||||
endf
|
||||
|
||||
fu! s:matargs(mfunc, str)
|
||||
let match_type = {
|
||||
\ 'match': 'full-line',
|
||||
\ 's:matchfname': 'filename-only',
|
||||
\ 's:matchtabs': 'first-non-tab',
|
||||
\ 's:matchtabe': 'until-last-tab',
|
||||
\ }
|
||||
retu [s:matcher['match'], a:str, match_type[a:mfunc]]
|
||||
endf
|
||||
" Entering & Exiting {{{2
|
||||
fu! s:getenv()
|
||||
let [s:cwd, s:winres] = [getcwd(), [winrestcmd(), &lines, winnr('$')]]
|
||||
let [s:crfile, s:crfpath] = [expand('%:p', 1), expand('%:p:h', 1)]
|
||||
let [s:crword, s:crline] = [expand('<cword>'), getline('.')]
|
||||
let [s:winh, s:crcursor] = [min([s:mxheight, &lines]), getpos('.')]
|
||||
let [s:crbufnr, s:crvisual] = [bufnr('%'), s:lastvisual()]
|
||||
let s:currwin = s:mwbottom ? winnr() : winnr() + has('autocmd')
|
||||
let s:wpmode = exists('b:ctrlp_working_path_mode')
|
||||
\ ? b:ctrlp_working_path_mode : s:pathmode
|
||||
endf
|
||||
|
||||
fu! s:lastvisual()
|
||||
let cview = winsaveview()
|
||||
let [ovreg, ovtype] = [getreg('v'), getregtype('v')]
|
||||
let [oureg, outype] = [getreg('"'), getregtype('"')]
|
||||
sil! norm! gv"vy
|
||||
let selected = substitute(getreg('v'), '\n', '\\n', 'g')
|
||||
cal setreg('v', ovreg, ovtype)
|
||||
cal setreg('"', oureg, outype)
|
||||
cal winrestview(cview)
|
||||
retu selected
|
||||
endf
|
||||
|
||||
fu! s:log(m)
|
||||
if exists('g:ctrlp_log') && g:ctrlp_log | if a:m
|
||||
let cadir = ctrlp#utils#cachedir()
|
||||
sil! exe 'redi! >' cadir.s:lash(cadir).'ctrlp.log'
|
||||
el
|
||||
sil! redi END
|
||||
en | en
|
||||
endf
|
||||
|
||||
fu! s:openfile(cmd, fid, tail, ...)
|
||||
let cmd = a:cmd =~ '^[eb]$' && &modified ? 'hid '.a:cmd : a:cmd
|
||||
let cmd = cmd =~ '^tab' ? tabpagenr('$').cmd : cmd
|
||||
@@ -1465,32 +1504,7 @@ fu! s:openfile(cmd, fid, tail, ...)
|
||||
cal ctrlp#setlcdir()
|
||||
en
|
||||
endf
|
||||
|
||||
fu! s:writecache(read_cache, cache_file)
|
||||
if !a:read_cache && ( ( g:ctrlp_newcache || !filereadable(a:cache_file) )
|
||||
\ && s:caching || len(g:ctrlp_allfiles) > s:nocache_lim )
|
||||
if len(g:ctrlp_allfiles) > s:nocache_lim | let s:caching = 1 | en
|
||||
cal ctrlp#utils#writecache(g:ctrlp_allfiles)
|
||||
en
|
||||
endf
|
||||
|
||||
fu! ctrlp#j2l(nr)
|
||||
exe a:nr
|
||||
sil! norm! zvzz
|
||||
endf
|
||||
|
||||
fu! s:regexfilter(str)
|
||||
let str = a:str
|
||||
for key in keys(s:fpats) | if match(str, key) >= 0
|
||||
let str = substitute(str, s:fpats[key], '', 'g')
|
||||
en | endfo
|
||||
retu str
|
||||
endf
|
||||
|
||||
fu! s:walker(m, p, d)
|
||||
retu a:d > 0 ? a:p < a:m ? a:p + a:d : 0 : a:p > 0 ? a:p + a:d : a:m
|
||||
endf
|
||||
|
||||
" Matchfuncs {{{2
|
||||
fu! s:matchfname(item, pat)
|
||||
retu match(split(a:item, s:lash)[-1], a:pat)
|
||||
endf
|
||||
@@ -1502,9 +1516,13 @@ 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
|
||||
" Cache {{{2
|
||||
fu! s:writecache(read_cache, cache_file)
|
||||
if !a:read_cache && ( ( g:ctrlp_newcache || !filereadable(a:cache_file) )
|
||||
\ && s:caching || len(g:ctrlp_allfiles) > s:nocache_lim )
|
||||
if len(g:ctrlp_allfiles) > s:nocache_lim | let s:caching = 1 | en
|
||||
cal ctrlp#utils#writecache(g:ctrlp_allfiles)
|
||||
en
|
||||
endf
|
||||
|
||||
fu! s:insertcache(str)
|
||||
@@ -1529,27 +1547,19 @@ fu! s:type(...)
|
||||
\ ? g:ctrlp_ext_vars[s:itemtype - 3][a:0 ? 'type' : 'sname'] : s:itemtype
|
||||
endf
|
||||
|
||||
fu! s:tagfiles()
|
||||
retu filter(map(tagfiles(), 'fnamemodify(v:val, ":p")'), 'filereadable(v:val)')
|
||||
endf
|
||||
|
||||
fu! s:extvar(key)
|
||||
fu! s:execextvar(key)
|
||||
if exists('g:ctrlp_ext_vars')
|
||||
cal map(filter(copy(g:ctrlp_ext_vars),
|
||||
\ 'has_key(v:val, a:key)'), 'eval(v:val[a:key])')
|
||||
en
|
||||
endf
|
||||
|
||||
fu! s:getundo()
|
||||
if exists('*undotree')
|
||||
\ && ( v:version > 703 || ( v:version == 703 && has('patch005') ) )
|
||||
retu [1, undotree()]
|
||||
el
|
||||
redi => result
|
||||
sil! undol
|
||||
redi END
|
||||
retu [0, split(result, "\n")[1:]]
|
||||
fu! s:getextvar(key)
|
||||
if s:itemtype > 2
|
||||
let vars = g:ctrlp_ext_vars[s:itemtype - 3]
|
||||
retu has_key(vars, a:key) ? vars[a:key] : -1
|
||||
en
|
||||
retu -1
|
||||
endf
|
||||
|
||||
fu! ctrlp#exit()
|
||||
@@ -1567,11 +1577,7 @@ endf
|
||||
" * Initialization {{{1
|
||||
fu! ctrlp#setlines(type)
|
||||
let s:itemtype = a:type
|
||||
let types = [
|
||||
\ 'ctrlp#files()',
|
||||
\ 'ctrlp#buffers()',
|
||||
\ 'ctrlp#mrufiles#list()',
|
||||
\ ]
|
||||
let types = ['ctrlp#files()', 'ctrlp#buffers()', 'ctrlp#mrufiles#list()']
|
||||
if exists('g:ctrlp_ext_vars')
|
||||
cal map(copy(g:ctrlp_ext_vars), 'add(types, v:val["init"])')
|
||||
en
|
||||
@@ -1583,6 +1589,7 @@ fu! ctrlp#init(type, ...)
|
||||
let [s:matches, s:init] = [1, 1]
|
||||
cal s:Open()
|
||||
cal s:SetWD(a:0 ? a:1 : '')
|
||||
cal s:SetDefTxt()
|
||||
cal s:MapKeys()
|
||||
if has('syntax') && exists('g:syntax_on')
|
||||
cal ctrlp#syntax()
|
||||
|
||||
@@ -17,6 +17,7 @@ let s:changes_var = {
|
||||
\ 'sname': 'chs',
|
||||
\ 'exit': 'ctrlp#changes#exit()',
|
||||
\ 'type': 'tabe',
|
||||
\ 'sort': 0,
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
|
||||
@@ -16,6 +16,7 @@ let s:var_qf = {
|
||||
\ 'lname': 'quickfix',
|
||||
\ 'sname': 'qfx',
|
||||
\ 'type': 'line',
|
||||
\ 'sort': 0,
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
|
||||
@@ -11,10 +11,11 @@ en
|
||||
let g:loaded_ctrlp_tag = 1
|
||||
|
||||
let s:tag_var = {
|
||||
\ 'init': 'ctrlp#tag#init(s:tagfiles)',
|
||||
\ 'init': 'ctrlp#tag#init()',
|
||||
\ 'accept': 'ctrlp#tag#accept',
|
||||
\ 'lname': 'tags',
|
||||
\ 'sname': 'tag',
|
||||
\ 'enter': 'ctrlp#tag#enter()',
|
||||
\ 'type': 'tabs',
|
||||
\ }
|
||||
|
||||
@@ -57,10 +58,10 @@ fu! s:filter(tags)
|
||||
retu alltags
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#tag#init(tagfiles)
|
||||
if empty(a:tagfiles) | retu [] | en
|
||||
fu! ctrlp#tag#init()
|
||||
if empty(s:tagfiles) | retu [] | en
|
||||
let g:ctrlp_alltags = []
|
||||
let tagfiles = sort(filter(a:tagfiles, 'count(a:tagfiles, v:val) == 1'))
|
||||
let tagfiles = sort(filter(s:tagfiles, 'count(s:tagfiles, v:val) == 1'))
|
||||
for each in tagfiles
|
||||
let alltags = s:filter(ctrlp#utils#readfile(each))
|
||||
cal extend(g:ctrlp_alltags, alltags)
|
||||
@@ -101,6 +102,12 @@ endf
|
||||
fu! ctrlp#tag#id()
|
||||
retu s:id
|
||||
endf
|
||||
|
||||
fu! ctrlp#tag#enter()
|
||||
let tfs = tagfiles()
|
||||
let s:tagfiles = tfs != [] ? filter(map(tfs, 'fnamemodify(v:val, ":p")'),
|
||||
\ 'filereadable(v:val)') : []
|
||||
endf
|
||||
"}}}
|
||||
|
||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
||||
|
||||
@@ -11,12 +11,14 @@ en
|
||||
let g:loaded_ctrlp_undo = 1
|
||||
|
||||
let s:undo_var = {
|
||||
\ 'init': 'ctrlp#undo#init(s:undos)',
|
||||
\ 'init': 'ctrlp#undo#init()',
|
||||
\ 'accept': 'ctrlp#undo#accept',
|
||||
\ 'lname': 'undo',
|
||||
\ 'sname': 'udo',
|
||||
\ 'enter': 'ctrlp#undo#enter()',
|
||||
\ 'exit': 'ctrlp#undo#exit()',
|
||||
\ 'type': 'line',
|
||||
\ 'sort': 0,
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
@@ -27,6 +29,18 @@ let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
let s:text = map(['second', 'seconds', 'minutes', 'hours', 'days', 'weeks',
|
||||
\ 'months', 'years'], '" ".v:val." ago"')
|
||||
" Utilities {{{1
|
||||
fu! s:getundo()
|
||||
if exists('*undotree')
|
||||
\ && ( v:version > 703 || ( v:version == 703 && has('patch005') ) )
|
||||
retu [1, undotree()]
|
||||
el
|
||||
redi => result
|
||||
sil! undol
|
||||
redi END
|
||||
retu [0, split(result, "\n")[1:]]
|
||||
en
|
||||
endf
|
||||
|
||||
fu! s:flatten(tree, cur)
|
||||
let flatdict = {}
|
||||
for each in a:tree
|
||||
@@ -104,16 +118,16 @@ fu! s:formatul(...)
|
||||
retu parts[2].' ['.parts[1].']'.( parts[3] != '' ? ' saved' : '' )
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#undo#init(undo)
|
||||
let entries = a:undo[0] ? a:undo[1]['entries'] : a:undo[1]
|
||||
fu! ctrlp#undo#init()
|
||||
let entries = s:undos[0] ? s:undos[1]['entries'] : s:undos[1]
|
||||
if empty(entries) | retu [] | en
|
||||
if has('syntax') && exists('g:syntax_on')
|
||||
cal s:syntax()
|
||||
en
|
||||
let g:ctrlp_nolimit = 1
|
||||
if !exists('s:lines')
|
||||
if a:undo[0]
|
||||
let entries = s:dict2list(s:flatten(entries, a:undo[1]['seq_cur']))
|
||||
if s:undos[0]
|
||||
let entries = s:dict2list(s:flatten(entries, s:undos[1]['seq_cur']))
|
||||
let s:lines = map(sort(entries, 's:compval'), 's:format(v:val)')
|
||||
el
|
||||
let s:lines = map(reverse(entries), 's:formatul(v:val)')
|
||||
@@ -133,6 +147,10 @@ fu! ctrlp#undo#id()
|
||||
retu s:id
|
||||
endf
|
||||
|
||||
fu! ctrlp#undo#enter()
|
||||
let s:undos = s:getundo()
|
||||
endf
|
||||
|
||||
fu! ctrlp#undo#exit()
|
||||
unl! s:lines
|
||||
endf
|
||||
|
||||
@@ -36,7 +36,7 @@ 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: >
|
||||
Use this option to change the mapping to invoke CtrlP in |Normal| mode: >
|
||||
let g:ctrlp_map = '<c-p>'
|
||||
<
|
||||
|
||||
@@ -51,7 +51,8 @@ Use this to disable the plugin completely: >
|
||||
<
|
||||
|
||||
*'g:ctrlp_by_filename'*
|
||||
Set this to 1 to set searching by filename (not full path) as the default: >
|
||||
Set this to 1 to set searching by filename (as opposed to full path) as the
|
||||
default: >
|
||||
let g:ctrlp_by_filename = 0
|
||||
<
|
||||
Can be toggled on/off by pressing <c-d> inside the prompt.
|
||||
@@ -80,7 +81,7 @@ 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: >
|
||||
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 it’s opened in the current tab.
|
||||
@@ -88,7 +89,7 @@ When opening a file with <cr> or <c-t>, if the file’s already opened somewhere
|
||||
0 - disable this feature.
|
||||
|
||||
*'g:ctrlp_reuse_window'*
|
||||
When opening a file with <cr>, |CtrlP| avoids opening it in windows created by
|
||||
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'
|
||||
<
|
||||
@@ -99,7 +100,7 @@ Example: >
|
||||
<
|
||||
|
||||
*'g:ctrlp_working_path_mode'*
|
||||
When starting up, |CtrlP| sets its local working directory according to this
|
||||
When starting up, CtrlP sets its local working directory according to this
|
||||
variable: >
|
||||
let g:ctrlp_working_path_mode = 2
|
||||
<
|
||||
@@ -111,19 +112,17 @@ 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: >
|
||||
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 = ['']
|
||||
<
|
||||
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|.
|
||||
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
|
||||
@@ -137,7 +136,7 @@ Set the directory to store the cache files: >
|
||||
<
|
||||
|
||||
*'g:ctrlp_prompt_mappings'*
|
||||
Use this to customize the mappings inside |CtrlP|’s prompt to your liking. You
|
||||
Use this to customize the mappings inside CtrlP’s prompt to your liking. You
|
||||
only need to keep the lines that you’ve changed the values (inside []): >
|
||||
let g:ctrlp_prompt_mappings = {
|
||||
\ 'PrtBS()': ['<bs>', '<c-]>'],
|
||||
@@ -182,13 +181,12 @@ default <c-h> mapping: >
|
||||
<
|
||||
|
||||
*'g:ctrlp_mruf_max'*
|
||||
Specify the number of recently opened files you want |CtrlP| to remember: >
|
||||
Specify the number of recently opened files you want CtrlP to remember: >
|
||||
let g:ctrlp_mruf_max = 250
|
||||
<
|
||||
|
||||
*'g:ctrlp_mruf_exclude'*
|
||||
Files you don’t want |CtrlP| to remember. Use |regexp| to specify the patterns:
|
||||
>
|
||||
Files you don’t want CtrlP to remember. Use |regexp| to specify the patterns: >
|
||||
let g:ctrlp_mruf_exclude = ''
|
||||
<
|
||||
Examples: >
|
||||
@@ -197,7 +195,7 @@ Examples: >
|
||||
<
|
||||
|
||||
*'g:ctrlp_mruf_include'*
|
||||
And if you want |CtrlP| to only remember some files, specify them here: >
|
||||
And if you want CtrlP to only remember some files, specify them here: >
|
||||
let g:ctrlp_mruf_include = ''
|
||||
<
|
||||
Example: >
|
||||
@@ -221,7 +219,7 @@ Set to 1 to sort the MRU file list to most-recently-entered-buffer order: >
|
||||
<
|
||||
|
||||
*'g:ctrlp_dotfiles'*
|
||||
Set this to 0 if you don’t want |CtrlP| to scan for dotfiles and dotdirs: >
|
||||
Set this to 0 if you don’t want CtrlP to scan for dotfiles and dotdirs: >
|
||||
let g:ctrlp_dotfiles = 1
|
||||
<
|
||||
You can use |'wildignore'| to exclude anything from the search.
|
||||
@@ -239,7 +237,7 @@ 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: >
|
||||
CtrlP to not show. Use |regexp| to specify the patterns: >
|
||||
let g:ctrlp_custom_ignore = ''
|
||||
<
|
||||
Examples: >
|
||||
@@ -250,6 +248,7 @@ Examples: >
|
||||
\ 'link': 'SOME_BAD_SYMBOLIC_LINKS',
|
||||
\ }
|
||||
<
|
||||
Note: ignoring only works when |globpath()| is used to scan for files.
|
||||
|
||||
*'g:ctrlp_max_files'*
|
||||
The maximum number of files to scan, set to 0 for no limit: >
|
||||
@@ -302,7 +301,7 @@ 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
|
||||
The maximum number of input strings you want CtrlP to remember. The default
|
||||
value mirrors Vim’s global |'history'| option: >
|
||||
let g:ctrlp_max_history = &history
|
||||
<
|
||||
@@ -368,6 +367,12 @@ after typing’s been stopped for a certain amount of time: >
|
||||
If is 1, update after 250ms. If bigger than 1, the number will be used as the
|
||||
delay time in milliseconds.
|
||||
|
||||
*'g:ctrlp_default_input'*
|
||||
Set this to 1 to enable seeding the prompt with the current file’s relative
|
||||
path: >
|
||||
let g:ctrlp_default_input = 0
|
||||
<
|
||||
|
||||
*'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: >
|
||||
@@ -375,7 +380,7 @@ works in |regexp| mode. To split the pattern, separate words with space: >
|
||||
<
|
||||
|
||||
*'g:ctrlp_status_func'*
|
||||
Use this to customize the statuslines for the |CtrlP| window: >
|
||||
Use this to customize the statuslines for the CtrlP window: >
|
||||
let g:ctrlp_status_func = {}
|
||||
<
|
||||
Example: >
|
||||
@@ -385,6 +390,7 @@ Example: >
|
||||
\ }
|
||||
<
|
||||
Structure of the functions: >
|
||||
" Main statusline
|
||||
function! Function_Name_1(focus, byfname, regex, prev, item, next, marked)
|
||||
" Arguments:
|
||||
" |
|
||||
@@ -406,6 +412,7 @@ Structure of the functions: >
|
||||
return full_statusline
|
||||
endfunction
|
||||
|
||||
" Progress statusline
|
||||
function! Function_Name_2(str)
|
||||
" a:str : Either the number of files scanned so far, or a string indicating
|
||||
" the current directory is being scanned with a user_command.
|
||||
@@ -416,7 +423,7 @@ Structure of the functions: >
|
||||
See https://gist.github.com/1610859 for a working example.
|
||||
|
||||
*'g:ctrlp_match_func'*
|
||||
Set an external fuzzy matching function for |CtrlP| to use: >
|
||||
Set an external fuzzy matching function for CtrlP to use: >
|
||||
let g:ctrlp_match_func = {}
|
||||
<
|
||||
Example: >
|
||||
@@ -456,7 +463,7 @@ COMMANDS *ctrlp-commands*
|
||||
|
||||
*:CtrlP*
|
||||
:CtrlP [starting-directory]
|
||||
Open |CtrlP| in find file mode.
|
||||
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.
|
||||
@@ -464,17 +471,17 @@ COMMANDS *ctrlp-commands*
|
||||
|
||||
*:CtrlPBuffer*
|
||||
:CtrlPBuffer
|
||||
Open |CtrlP| in find buffer mode.
|
||||
Open CtrlP in find buffer mode.
|
||||
|
||||
*:CtrlPMRU*
|
||||
:CtrlPMRU
|
||||
Open |CtrlP| in find Most-Recently-Used file mode.
|
||||
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|.
|
||||
inside CtrlP.
|
||||
You can enable/disable caching with the |g:ctrlp_use_caching| option.
|
||||
|
||||
*:CtrlPClearAllCaches*
|
||||
:CtrlPClearAllCaches
|
||||
@@ -501,20 +508,20 @@ MAPPINGS *ctrlp-mappings*
|
||||
|
||||
*'ctrlp-<c-p>'*
|
||||
<c-p>
|
||||
Default |Normal| mode mapping to open the |CtrlP| prompt in find file mode.
|
||||
Default |Normal| mode mapping to open the CtrlP prompt in find file mode.
|
||||
|
||||
Once inside the prompt:~
|
||||
|
||||
<c-d>
|
||||
Toggle between full-path search and filename only search.
|
||||
Note: in filename mode, the prompt’s base is '>d>' instead of '>>>'
|
||||
|
||||
<c-r> *'ctrlp-fullregexp'*
|
||||
Toggle between the string mode and full |regexp| mode.
|
||||
Note: in full |regexp| mode, the prompt’s 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 prompt’s base is '>d>' instead of '>>>'
|
||||
|
||||
<c-f>, 'forward'
|
||||
<c-up>
|
||||
Scroll to the 'next' search mode in the sequence.
|
||||
@@ -575,9 +582,9 @@ Once inside the prompt:~
|
||||
<c-v>
|
||||
Open selected file in a 'vertical' split.
|
||||
|
||||
<c-x>,
|
||||
<c-cr>,
|
||||
<c-s>,
|
||||
<c-x>
|
||||
<c-s>
|
||||
Open selected file in a 'horizontal' split.
|
||||
|
||||
<c-y>
|
||||
@@ -591,26 +598,26 @@ Once inside the prompt:~
|
||||
|
||||
<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>.
|
||||
- Or 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.
|
||||
- Or remove deleted files from the MRU list.
|
||||
|
||||
<F7>
|
||||
- Wipe MRU list.
|
||||
- Delete MRU entries marked by <c-z>.
|
||||
- Wipe the MRU list.
|
||||
- Or delete MRU entries marked by <c-z>.
|
||||
|
||||
<insert>
|
||||
Insert the word under the cursor (in the active buffer) into the prompt.
|
||||
Insert the word under the cursor (in the current buffer) into the prompt.
|
||||
|
||||
<esc>,
|
||||
<c-c>,
|
||||
<c-g>
|
||||
Exit |CtrlP|.
|
||||
Exit CtrlP.
|
||||
Note: <c-c> can also be used to stop the scan if it’s taking too long.
|
||||
|
||||
Choose your own mappings with |g:ctrlp_prompt_mappings|.
|
||||
@@ -629,11 +636,13 @@ 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'
|
||||
|
||||
E.g. 'abc' is understood internally as 'a[^a]\{-}b[^b]\{-}c'
|
||||
|
||||
b) Vim |regexp|. If the input string contains '*' or '|', it’ll be treated as
|
||||
a Vim’s |regexp| |pattern| without any modification.
|
||||
e.g. 'abc\d*efg' will be read as 'abc\d*efg'.
|
||||
|
||||
E.g. 'abc\d*efg' will be read as 'abc\d*efg'.
|
||||
|
||||
See also |ctrlp-fullregexp| (keymap) and |g:ctrlp_regexp_search| (option).
|
||||
|
||||
@@ -641,13 +650,17 @@ 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'.
|
||||
|
||||
E.g. 'abc:45' will open the selected file and jump to line 45.
|
||||
|
||||
'abc:/any\:string' will open the selected file and jump to the first
|
||||
instance of 'any:string'.
|
||||
|
||||
'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.
|
||||
|
||||
'abc:diffthis' will open the selected files and run |:diffthis| on the
|
||||
first 4 files (if marked).
|
||||
|
||||
See also Vim’s |++opt| and |+cmd|.
|
||||
|
||||
@@ -662,11 +675,14 @@ e) Similarly, submit '/' or '\' to find and go to the project’s root. If the
|
||||
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
|
||||
|
||||
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.
|
||||
@@ -690,7 +706,8 @@ Available extensions:~
|
||||
- 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). Example: `set tags+=tags/help,doc/tags`
|
||||
locations of the tags file(s).
|
||||
E.g. set tags+=doc/tags
|
||||
|
||||
*:CtrlPBufTag*
|
||||
*:CtrlPBufTagAll*
|
||||
@@ -713,10 +730,10 @@ Available extensions:~
|
||||
- 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.
|
||||
+ <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
|
||||
+ <c-x> change the global working directory to CtrlP’s current local
|
||||
working directory (exit).
|
||||
|
||||
*:CtrlPRTS*
|
||||
@@ -778,7 +795,7 @@ Examples: >
|
||||
CUSTOMIZATION *ctrlp-customization*
|
||||
|
||||
Highlighting:~
|
||||
* For the |CtrlP| buffer:
|
||||
* 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
|
||||
@@ -878,7 +895,10 @@ Special thanks:~
|
||||
===============================================================================
|
||||
CHANGELOG *ctrlp-changelog*
|
||||
|
||||
+ New option: |g:ctrlp_match_func|, allow using a custom fuzzy matcher.
|
||||
Before 2012/03/31~
|
||||
|
||||
+ New option: |g:ctrlp_default_input|, default input when entering CtrlP.
|
||||
|g:ctrlp_match_func|, allow using a custom fuzzy matcher.
|
||||
+ Rename:
|
||||
*ClearCtrlPCache* -> |CtrlPClearCache|
|
||||
*ClearAllCtrlPCaches* -> |CtrlPClearAllCaches|
|
||||
|
||||
@@ -8,7 +8,10 @@
|
||||
if ( exists('g:loaded_ctrlp') && g:loaded_ctrlp ) || v:version < 700 || &cp
|
||||
fini
|
||||
en
|
||||
let [g:loaded_ctrlp, g:ctrlp_lines, g:ctrlp_allfiles] = [1, [], []]
|
||||
let g:loaded_ctrlp = 1
|
||||
|
||||
let [g:ctrlp_lines, g:ctrlp_allfiles, g:ctrlp_alltags, g:ctrlp_alldirs,
|
||||
\ g:ctrlp_buftags, g:ctrlp_builtins] = [[], [], [], [], {}, 2]
|
||||
|
||||
if !exists('g:ctrlp_map') | let g:ctrlp_map = '<c-p>' | en
|
||||
if !exists('g:ctrlp_cmd') | let g:ctrlp_cmd = 'CtrlP' | en
|
||||
@@ -36,47 +39,22 @@ en
|
||||
|
||||
cal ctrlp#mrufiles#init()
|
||||
|
||||
if !exists('g:ctrlp_extensions') | fini | en
|
||||
com! CtrlPTag cal ctrlp#init(ctrlp#tag#id())
|
||||
|
||||
let s:ext = g:ctrlp_extensions
|
||||
com! CtrlPQuickfix cal ctrlp#init(ctrlp#quickfix#id())
|
||||
|
||||
if index(s:ext, 'tag') >= 0
|
||||
let g:ctrlp_alltags = []
|
||||
com! CtrlPTag cal ctrlp#init(ctrlp#tag#id())
|
||||
en
|
||||
com! -n=? -com=dir CtrlPDir cal ctrlp#init(ctrlp#dir#id(), <q-args>)
|
||||
|
||||
if index(s:ext, 'quickfix') >= 0
|
||||
com! CtrlPQuickfix cal ctrlp#init(ctrlp#quickfix#id())
|
||||
en
|
||||
com! -n=? -com=buffer CtrlPBufTag
|
||||
\ cal ctrlp#init(ctrlp#buffertag#cmd(0, <q-args>))
|
||||
com! CtrlPBufTagAll cal ctrlp#init(ctrlp#buffertag#cmd(1))
|
||||
|
||||
if index(s:ext, 'dir') >= 0
|
||||
let g:ctrlp_alldirs = []
|
||||
com! -n=? -com=dir CtrlPDir cal ctrlp#init(ctrlp#dir#id(), <q-args>)
|
||||
en
|
||||
com! CtrlPRTS cal ctrlp#init(ctrlp#rtscript#id())
|
||||
|
||||
if index(s:ext, 'buffertag') >= 0
|
||||
let g:ctrlp_buftags = {}
|
||||
com! -n=? -com=buffer CtrlPBufTag
|
||||
\ cal ctrlp#init(ctrlp#buffertag#cmd(0, <q-args>))
|
||||
com! CtrlPBufTagAll cal ctrlp#init(ctrlp#buffertag#cmd(1))
|
||||
en
|
||||
com! CtrlPUndo cal ctrlp#init(ctrlp#undo#id())
|
||||
|
||||
if index(s:ext, 'rtscript') >= 0
|
||||
com! CtrlPRTS cal ctrlp#init(ctrlp#rtscript#id())
|
||||
en
|
||||
com! CtrlPLine cal ctrlp#init(ctrlp#line#id())
|
||||
|
||||
if index(s:ext, 'undo') >= 0
|
||||
com! CtrlPUndo cal ctrlp#init(ctrlp#undo#id())
|
||||
en
|
||||
|
||||
if index(s:ext, 'line') >= 0
|
||||
com! CtrlPLine cal ctrlp#init(ctrlp#line#id())
|
||||
en
|
||||
|
||||
if index(s:ext, 'changes') >= 0
|
||||
com! -n=? -com=buffer CtrlPChange
|
||||
\ cal ctrlp#init(ctrlp#changes#cmd(0, <q-args>))
|
||||
com! CtrlPChangeAll cal ctrlp#init(ctrlp#changes#cmd(1))
|
||||
en
|
||||
|
||||
unl s:ext
|
||||
com! -n=? -com=buffer CtrlPChange
|
||||
\ cal ctrlp#init(ctrlp#changes#cmd(0, <q-args>))
|
||||
com! CtrlPChangeAll cal ctrlp#init(ctrlp#changes#cmd(1))
|
||||
|
||||
Reference in New Issue
Block a user