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

Add find and dir support

This commit is contained in:
Shidong Wang 2018-12-09 10:04:55 +08:00
parent 333a070b42
commit 8e7e62a988
2 changed files with 10 additions and 2 deletions

View File

@ -263,7 +263,7 @@ fu! zvim#util#Generate_ignore(ignore,tool, ...) abort
elseif a:tool ==# 'rg' elseif a:tool ==# 'rg'
for ig in split(a:ignore,',') for ig in split(a:ignore,',')
call add(ignore, '-g') call add(ignore, '-g')
if a:0 > 0 if get(a:000, 0, 0) == 1
call add(ignore, "'!" . ig . "'") call add(ignore, "'!" . ig . "'")
else else
call add(ignore, '!' . ig) call add(ignore, '!' . ig)

View File

@ -1,3 +1,5 @@
let s:SYS = SpaceVim#api#import('system')
let g:ctrlp_map = get(g:,'ctrlp_map', '<c-p>') let g:ctrlp_map = get(g:,'ctrlp_map', '<c-p>')
let g:ctrlp_cmd = get(g:, 'ctrlp_cmd', 'CtrlP') let g:ctrlp_cmd = get(g:, 'ctrlp_cmd', 'CtrlP')
let g:ctrlp_working_path_mode = get(g:, 'ctrlp_working_path_mode', 'ra') let g:ctrlp_working_path_mode = get(g:, 'ctrlp_working_path_mode', 'ra')
@ -18,9 +20,15 @@ let g:ctrlp_custom_ignore = get(g:, 'ctrlp_custom_ignore', {
\ }) \ })
if executable('rg') && !exists('g:ctrlp_user_command') if executable('rg') && !exists('g:ctrlp_user_command')
let g:ctrlp_user_command = 'rg %s --no-ignore --hidden --files -g "" ' let g:ctrlp_user_command = 'rg %s --no-ignore --hidden --files -g "" '
\ . join(zvim#util#Generate_ignore(get(g:, 'spacevim_wildignore', ''),'rg')) \ . join(zvim#util#Generate_ignore(get(g:, 'spacevim_wildignore', ''),'rg', SpaceVim#api#import('system').isWindows ? 0 : 1))
elseif executable('ag') && !exists('g:ctrlp_user_command') elseif executable('ag') && !exists('g:ctrlp_user_command')
let g:ctrlp_user_command = 'ag --hidden -i -g "" ' . join(zvim#util#Generate_ignore(g:spacevim_wildignore,'ag')) . ' %s' let g:ctrlp_user_command = 'ag --hidden -i -g "" ' . join(zvim#util#Generate_ignore(g:spacevim_wildignore,'ag')) . ' %s'
elseif s:SYS.isWindows
let g:ctrlp_user_command =
\ 'dir %s /-n /b /s /a-d | findstr /v /l ".jpg \\tmp\\"' " Windows
else
let g:ctrlp_user_command =
\ 'find %s -type f | grep -v -P "\.jpg$|/tmp/"' " MacOSX/Linux
endif endif
if !exists('g:ctrlp_match_func') && (has('python') || has('python3')) if !exists('g:ctrlp_match_func') && (has('python') || has('python3'))
let g:ctrlp_match_func = { 'match': 'pymatcher#PyMatch' } let g:ctrlp_match_func = { 'match': 'pymatcher#PyMatch' }