Skip to content

Commit 32eef64

Browse files
author
Andreas Pataki
committed
Optimize ctrl-p file search
Depending on the availability the fastest method is used. The search order is: 1) fd / fdfind (debian) 2) rg 3) ag 4) ctrlp
1 parent 9f5aa13 commit 32eef64

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

plugins.vim

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,17 @@ let g:airline_powerline_fonts=1
150150
" CtrlP
151151
" ---------------
152152
let g:ctrlp_working_path_mode = 'rc'
153-
if executable('ag')
154-
let g:ctrlp_user_command = '[[ $PWD == $HOME ]] && echo "Blocked in $HOME!" ||
155-
\ ag %s -i --nocolor --nogroup --hidden
153+
154+
let ctrlpFailSafe = '[[ $PWD == $HOME ]] && echo "Blocked in $HOME!" || '
155+
156+
if executable('fd')
157+
let g:ctrlp_user_command = ctrlpFailSafe . 'fd --type file --color never "" %s'
158+
elseif executable('fdfind')
159+
let g:ctrlp_user_command = ctrlpFailSafe . 'fdfind --type file --color never "" %s'
160+
elseif executable('rg')
161+
let g:ctrlp_user_command = ctrlpFailSafe . 'rg %s --files --color never --glob ""'
162+
elseif executable('ag')
163+
let g:ctrlp_user_command = ctrlpFailSafe . 'ag %s -i --nocolor --nogroup --hidden
156164
\ --ignore .git
157165
\ --ignore .svn
158166
\ --ignore .hg

0 commit comments

Comments
 (0)