Skip to content

Commit bc2fc83

Browse files
author
Andreas Pataki
committed
Improve Ctrl-P unser command
- Block running in users home directory - Check if 'ag' command exists
1 parent b7a992e commit bc2fc83

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

plugins.vim

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,15 @@ let g:airline_powerline_fonts=1
150150
" CtrlP
151151
" ---------------
152152
let g:ctrlp_working_path_mode = 'rc'
153-
let g:ctrlp_user_command = 'ag %s -i --nocolor --nogroup --hidden
154-
\ --ignore .git
155-
\ --ignore .svn
156-
\ --ignore .hg
157-
\ --ignore .DS_Store
158-
\ -g ""'
153+
if executable('ag')
154+
let g:ctrlp_user_command = '[[ $PWD == $HOME ]] && echo "Blocked in $HOME!" ||
155+
\ ag %s -i --nocolor --nogroup --hidden
156+
\ --ignore .git
157+
\ --ignore .svn
158+
\ --ignore .hg
159+
\ --ignore .DS_Store
160+
\ -g ""'
161+
endif
159162
let g:ctrlp_prompt_mappings = {
160163
\ 'AcceptSelection("h")': ['<c-x>', '<c-s>'],
161164
\ 'AcceptSelection("t")': ['<c-t>', '<c-cr>'],

0 commit comments

Comments
 (0)