diff --git a/autoload/ctrlp.vim b/autoload/ctrlp.vim index 7b85f02..64e5551 100644 --- a/autoload/ctrlp.vim +++ b/autoload/ctrlp.vim @@ -45,6 +45,7 @@ fu! s:opts() endfo if !exists('g:ctrlp_newcache') | let g:ctrlp_newcache = 0 | en let s:maxdepth = min([s:maxdepth, 100]) + let s:mxheight = max([s:mxheight, 1]) let s:igntype = empty(s:usrign) ? -1 : type(s:usrign) " Extensions let g:ctrlp_builtins = 2 @@ -1087,11 +1088,10 @@ fu! s:findroot(curr, mark, depth, type) let [depth, notfound] = [a:depth + 1, empty(s:glbpath(a:curr, a:mark, 1))] if !notfound || depth > s:maxdepth if notfound | cal ctrlp#setdir(s:cwd) | en - if a:type | if depth <= s:maxdepth + if a:type && depth <= s:maxdepth let s:vcsroot = a:curr - en | el - cal ctrlp#setdir(a:curr) - let s:foundroot = 1 + elsei !a:type && !notfound + cal ctrlp#setdir(a:curr) | let s:foundroot = 1 en el let parent = s:getparent(a:curr) diff --git a/autoload/ctrlp/mrufiles.vim b/autoload/ctrlp/mrufiles.vim index 3bd16a7..d279c74 100644 --- a/autoload/ctrlp/mrufiles.vim +++ b/autoload/ctrlp/mrufiles.vim @@ -12,6 +12,7 @@ fu! ctrlp#mrufiles#opts() \ 'g:ctrlp_mruf_exclude': ['s:exclude', ''], \ 'g:ctrlp_mruf_case_sensitive': ['s:csen', 1], \ 'g:ctrlp_mruf_relative': ['s:relate', 0], + \ 'g:ctrlp_mruf_last_entered': ['s:mre', 0], \ } for [ke, va] in items(opts) exe 'let' va[0] '=' string(exists(ke) ? eval(ke) : va[1]) @@ -43,7 +44,7 @@ fu! ctrlp#mrufiles#list(bufnr, ...) "{{{1 let mrufs = ctrlp#utils#readfile(s:cafile) " Remove non-existent files if a:0 && a:1 == 1 - cal filter(mrufs, '!empty(ctrlp#utils#glob(v:val, 1))') + cal filter(mrufs, '!empty(ctrlp#utils#glob(v:val, 1)) && !s:excl(v:val)') cal ctrlp#utils#writecache(mrufs, s:cadir, s:cafile) en " Return the list with the active buffer removed @@ -65,12 +66,19 @@ fu! ctrlp#mrufiles#list(bufnr, ...) "{{{1 if len(mrufs) > s:max | cal remove(mrufs, s:max, -1) | en cal ctrlp#utils#writecache(mrufs, s:cadir, s:cafile) endf "}}} +fu! s:excl(fname) "{{{ + retu !empty(s:exclude) && a:fname =~# s:exclude +endf "}}} fu! ctrlp#mrufiles#init() "{{{1 let s:locked = 0 aug CtrlPMRUF au! au BufReadPost,BufNewFile,BufWritePost * \ cal ctrlp#mrufiles#list(expand('', 1)) + if s:mre + au BufEnter,BufUnload * + \ cal ctrlp#mrufiles#list(expand('', 1)) + en au QuickFixCmdPre *vimgrep* let s:locked = 1 au QuickFixCmdPost *vimgrep* let s:locked = 0 aug END diff --git a/autoload/ctrlp/tag.vim b/autoload/ctrlp/tag.vim index 8af8a90..d1b9a09 100644 --- a/autoload/ctrlp/tag.vim +++ b/autoload/ctrlp/tag.vim @@ -33,8 +33,7 @@ endf fu! s:findcount(str) let [tg, fname] = split(a:str, '\t\+\ze[^\t]\+$') - let [&l:tags, fname] = [s:ltags, expand(fname, 1)] - let tgs = taglist('^'.tg.'$') + let [fname, tgs] = [expand(fname, 1), taglist('^'.tg.'$')] if empty(tgs) | retu [1, 1] | en let [fnd, ct, pos] = [0, 0, 0] for each in tgs @@ -68,9 +67,7 @@ endf " Public {{{1 fu! ctrlp#tag#init(tagfiles) if empty(a:tagfiles) | retu [] | en - let tagfiles = sort(s:nodup(a:tagfiles)) - let s:ltags = join(tagfiles, ',') - let g:ctrlp_alltags = [] + let [tagfiles, g:ctrlp_alltags] = [sort(s:nodup(a:tagfiles)), []] for each in tagfiles let alltags = s:filter(ctrlp#utils#readfile(each)) cal extend(g:ctrlp_alltags, alltags) @@ -86,17 +83,18 @@ fu! ctrlp#tag#accept(mode, str) let [md, tg] = [a:mode, split(str, '^[^\t]\+\zs\t')[0]] let fnd = s:findcount(str) let cmds = { - \ 't': ['tabe', 'tab stj'], - \ 'h': ['new', 'stj'], - \ 'v': ['vne', 'vert stj'], - \ 'e': ['ene', 'tj'], + \ 't': ['tab sp', 'tab stj'], + \ 'h': ['sp', 'stj'], + \ 'v': ['vs', 'vert stj'], + \ 'e': ['', 'tj'], \ } let cmd = fnd[0] == 1 ? cmds[md][0] : cmds[md][1] - let cmd = cmd =~ 'tj\|ene' && &modified ? 'hid '.cmd : cmd + let cmd = cmd == 'tj' && &modified ? 'hid '.cmd : cmd try if fnd[0] == 1 - exe cmd - let &l:tags = s:ltags + if cmd != '' + exe cmd + en exe fnd[1].'ta' tg el exe cmd.' '.tg diff --git a/doc/ctrlp.txt b/doc/ctrlp.txt index e179a64..f5d2872 100644 --- a/doc/ctrlp.txt +++ b/doc/ctrlp.txt @@ -66,8 +66,8 @@ Set this to 0 to show the match window at the top of the screen: > < *'g:ctrlp_match_window_reversed'* -Reverse the sort order of the matched files in the match window. The default -setting is from bottom to top: > +Change the listing order of the matched files in the match window. The default +setting (1) is from bottom to top: > let g:ctrlp_match_window_reversed = 1 < @@ -179,7 +179,7 @@ Specify the number of recently opened files you want |CtrlP| to remember: > < *'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 = '' < @@ -207,6 +207,11 @@ MRU entries: > let g:ctrlp_mruf_case_sensitive = 1 < + *'g:ctrlp_mruf_last_entered'* +Set to 1 to sort the MRU file list to most-recently-entered-buffer order: > + let g:ctrlp_mruf_last_entered = 0 +< + *'g:ctrlp_dotfiles'* Set this to 0 if you don’t want |CtrlP| to search for dotfiles and dotdirs: > let g:ctrlp_dotfiles = 1 @@ -235,7 +240,7 @@ Examples: > \ 'file': '\.exe$\|\.so$\|\.dll$', \ 'link': 'some$\|bad$\|symbolic$\|links$', \ } -> +< *'g:ctrlp_highlight_match'* Use this to enable/disable highlighting of the matched patterns and to specify @@ -688,13 +693,6 @@ USER-CONFIGURATION *ctrlp-user-config* Some miscellaneous configurations:~ -+) MRU ==> MRE (most-recently-entered): > - autocmd BufEnter,BufUnload * call ctrlp#mrufiles#list(expand('', 1)) -< -The default implementation of MRU is similar to that of desktop applications. -Use the above |autocmd| to change it to recording most-recently-entered buffers -(that have a file) instead. - +) |g:ctrlp_user_command| config that makes use of your |wildignore| setting: https://github.com/kien/ctrlp.vim/issues/70 by Rich Alesi @@ -741,6 +739,8 @@ Special thanks:~ =============================================================================== CHANGELOG *ctrlp-changelog* + + New option: |g:ctrlp_mruf_last_entered| change MRU to recently-entered + Before 2012/01/15~ + New mapping: Switch and . is now used for completion