Permalink
Browse files

Ignore ignored cwd

  • Loading branch information...
1 parent 7bbe405 commit f4f5d052b92ae75cf8500247f00f39e51d61fe24 @kien committed Mar 5, 2013
Showing with 15 additions and 3 deletions.
  1. +12 −2 autoload/ctrlp.vim
  2. +3 −1 autoload/ctrlp/dir.vim
View
14 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
View
4 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')

0 comments on commit f4f5d05

Please sign in to comment.