1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 10:20:05 +08:00

Fix ctrlp file finder

fix #516
This commit is contained in:
wsdjeg 2017-05-29 22:52:32 +08:00
parent 96248f8ba6
commit 4c4dd609b0
2 changed files with 7 additions and 3 deletions

View File

@ -272,7 +272,7 @@ function! zvim#util#UpdateHosts(...) abort
echo 'successfully!'
endif
endfunction
fu! zvim#util#Generate_ignore(ignore,tool) abort
fu! zvim#util#Generate_ignore(ignore,tool, ...) abort
let ignore = []
if a:tool ==# 'ag'
for ig in split(a:ignore,',')
@ -282,7 +282,11 @@ fu! zvim#util#Generate_ignore(ignore,tool) abort
elseif a:tool ==# 'rg'
for ig in split(a:ignore,',')
call add(ignore, '-g')
call add(ignore, '!' . ig)
if a:0 > 0
call add(ignore, "'!" . ig . "'")
else
call add(ignore, '!' . ig)
endif
endfor
endif
return ignore

View File

@ -18,7 +18,7 @@ let g:ctrlp_custom_ignore = get(g:, 'ctrlp_custom_ignore', {
\ })
if executable('rg') && !exists('g:ctrlp_user_command')
let g:ctrlp_user_command = 'rg %s --no-ignore --hidden --files -g "" '
\ . join(zvim#util#Generate_ignore(g:spacevim_wildignore,'rg'))
\ . join(zvim#util#Generate_ignore(g:spacevim_wildignore,'rg', 1))
elseif executable('ag') && !exists('g:ctrlp_user_command')
let g:ctrlp_user_command = 'ag %s --hidden -i -g "" ' . join(zvim#util#Generate_ignore(g:spacevim_wildignore,'ag'))
endif