update docs on using wildignore

This commit is contained in:
Kien N 2011-09-14 00:17:20 +07:00
parent c360f2db47
commit e311264c38
3 changed files with 37 additions and 11 deletions

View File

@ -658,7 +658,7 @@ func! s:MapSpecs(...)
\ } \ }
for each in keys(prttempdis) for each in keys(prttempdis)
if g:ctrlp_mru_files && !has_key(prtmaps, each) if g:ctrlp_mru_files && !has_key(prtmaps, each)
cal extend(prtmaps, {each:prttempdis[each]}) cal extend(prtmaps, { each : prttempdis[each] })
elseif !g:ctrlp_mru_files elseif !g:ctrlp_mru_files
cal remove(prtmaps, each) cal remove(prtmaps, each)
endif endif
@ -855,8 +855,10 @@ endfunc
func! s:compmatlen(s1, s2) func! s:compmatlen(s1, s2)
" by match length " by match length
let mln1 = min(s:matchlens(a:s1, s:compat)) let lens1 = s:matchlens(a:s1, s:compat)
let mln2 = min(s:matchlens(a:s2, s:compat)) let lens2 = s:matchlens(a:s2, s:compat)
let mln1 = s:shortest(lens1) + ( s:wordonly(lens1) / 2 )
let mln2 = s:shortest(lens2) + ( s:wordonly(lens2) / 2 )
retu mln1 == mln2 ? 0 : mln1 > mln2 ? 1 : -1 retu mln1 == mln2 ? 0 : mln1 > mln2 ? 1 : -1
endfunc endfunc
@ -865,20 +867,41 @@ func! s:matchlens(str, pat, ...)
retu [] retu []
endif endif
let st = exists('a:1') ? a:1 : 0 let st = exists('a:1') ? a:1 : 0
let lens = exists('a:2') ? a:2 : [] let lens = exists('a:2') ? a:2 : {}
let nr = exists('a:3') ? a:3 : 0
if match(a:str, a:pat, st) != -1 if match(a:str, a:pat, st) != -1
let start = match(a:str, a:pat, st) let start = match(a:str, a:pat, st)
let str = matchstr(a:str, a:pat, st) let str = matchstr(a:str, a:pat, st)
let len = len(str) let len = len(str)
let end = matchend(a:str, a:pat, st) let end = matchend(a:str, a:pat, st)
let lens = add(lens, len) let lens = extend(lens, { nr : [len, str] })
let lens = s:matchlens(a:str, a:pat, end, lens) let lens = s:matchlens(a:str, a:pat, end, lens, nr + 1)
endif endif
retu lens retu lens
endfunc endfunc
func! s:shortest(lens)
let lns = []
for nr in keys(a:lens)
cal add(lns, a:lens[nr][0])
endfor
retu min(lns)
endfunc
func! s:wordonly(lens)
let lens = a:lens
let minln = s:shortest(lens)
cal filter(lens, 'minln == v:val[0]')
for nr in keys(lens)
if match(lens[nr][1], '\W') >= 0
retu 1
endif
endfor
retu 0
endfunc
func! s:mixedsort(s1, s2) func! s:mixedsort(s1, s2)
retu 2 * s:compmatlen(a:s1, a:s2) + s:compare(a:s1, a:s2) retu 3 * s:compmatlen(a:s1, a:s2) + s:compare(a:s1, a:s2)
endfunc endfunc
"}}} "}}}

View File

@ -194,9 +194,12 @@ Set this to 0 if you dont want |CtrlP| to search for dotfiles and dotdirs: >
< <
You can also use |'wildignore'| to exclude anything from the search. You can also use |'wildignore'| to exclude anything from the search.
e.g. exclude version control directories from the results: > e.g. exclude version control directories from the results: >
set wildignore+=.git/*,.hg/*,.svn/* " Linux/MacOSX set wildignore+=*/.git/*,*/.hg/*,*/.svn/* " Linux/MacOSX
set wildignore+=.git\*,.hg\*,.svn\* " Windows set wildignore+=.git\*,.hg\*,.svn\* " Windows
< <
Note: the `*/` in front of each glob is required for the dotfiles search
feature to work correctly along side with |wildignore|. If youve disabled
dotfiles search (set |g:ctrlp_dotfiles| to 0), then you can ignore this.
*'g:ctrlp_highlight_match'* *'g:ctrlp_highlight_match'*
Use this to enable/disable highlighting of the matched patterns and to specify Use this to enable/disable highlighting of the matched patterns and to specify

View File

@ -62,7 +62,7 @@ The parameter is the same (0, 1 or 2):
e.g. Just have something like this in your vimrc: e.g. Just have something like this in your vimrc:
```vim ```vim
set wildignore+=.git/*,.hg/*,.svn/* " for Linux/MacOSX set wildignore+=*/.git/*,*/.hg/*,*/.svn/* " for Linux/MacOSX
set wildignore+=.git\*,.hg\*,.svn\* " for Windows set wildignore+=.git\*,.hg\*,.svn\* " for Windows
``` ```