From f4f5d052b92ae75cf8500247f00f39e51d61fe24 Mon Sep 17 00:00:00 2001 From: Kien N Date: Tue, 5 Mar 2013 12:02:18 +0700 Subject: [PATCH] Ignore ignored cwd --- autoload/ctrlp.vim | 14 ++++++++++++-- autoload/ctrlp/dir.vim | 4 +++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/autoload/ctrlp.vim b/autoload/ctrlp.vim index d11bbff..90473e4 100644 --- a/autoload/ctrlp.vim +++ b/autoload/ctrlp.vim @@ -316,7 +316,9 @@ fu! ctrlp#files() let [lscmd, s:initcwd, g:ctrlp_allfiles] = [s:lsCmd(), s:dyncwd, []] " Get the list of files if empty(lscmd) - cal s:GlobPath(s:fnesc(s:dyncwd, 'g', ','), 0) + if !ctrlp#igncwd(s:dyncwd) + cal s:GlobPath(s:fnesc(s:dyncwd, 'g', ','), 0) + en el sil! cal ctrlp#progress('Indexing...') try | cal s:UserCmd(lscmd) @@ -353,6 +355,9 @@ endf fu! s:UserCmd(lscmd) let [path, lscmd] = [s:dyncwd, a:lscmd] + let do_ign = + \ type(s:usrcmd) == 4 && has_key(s:usrcmd, 'ignore') && s:usrcmd['ignore'] + if do_ign && ctrlp#igncwd(s:cwd) | retu | en if exists('+ssl') && &ssl let [ssl, &ssl, path] = [&ssl, 0, tr(path, '/', '\')] en @@ -368,7 +373,7 @@ fu! s:UserCmd(lscmd) if exists('s:vcscmd') && s:vcscmd cal map(g:ctrlp_allfiles, 'tr(v:val, "/", "\\")') en - if type(s:usrcmd) == 4 && has_key(s:usrcmd, 'ignore') && s:usrcmd['ignore'] + if do_ign if !empty(s:usrign) let g:ctrlp_allfiles = ctrlp#dirnfile(g:ctrlp_allfiles)[1] en @@ -1362,6 +1367,11 @@ fu! s:ispathitem() retu s:itemtype < 3 || ( s:itemtype > 2 && s:getextvar('type') == 'path' ) endf +fu! ctrlp#igncwd(cwd) + retu ctrlp#utils#glob(a:cwd, 0) == '' || + \ ( s:igntype >= 0 && s:usrign(a:cwd, getftype(a:cwd)) ) +endf + fu! ctrlp#dirnfile(entries) let [items, cwd] = [[[], []], s:dyncwd.s:lash()] for each in a:entries diff --git a/autoload/ctrlp/dir.vim b/autoload/ctrlp/dir.vim index 2589a0b..091e66c 100644 --- a/autoload/ctrlp/dir.vim +++ b/autoload/ctrlp/dir.vim @@ -54,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(ctrlp#utils#fnesc(s:cwd, 'g', ','), 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')