Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the proper Vim/Ag g:ctrlp_user_command value for Windows?

Tags:

vim

ag

ctrlp

I would like to fill in the elsif in the portion of my .vimrc below, can anyone help me with the correct Windows syntax?

if executable( 'ag' )
    if has( 'unix' )
        let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
    elsif has( 'win32' )
        " ?
    endif
endif

The Unix version is not working in my Windows gvim.

like image 347
jbm Avatar asked Dec 01 '22 15:12

jbm


1 Answers

In addition to @amos's answer, you could actually make a bit more addition to use ag in CtrlP as mentioned here:

" Use The Silver Searcher https://github.com/ggreer/the_silver_searcher
if executable('ag')
  " Use Ag over Grep
  set grepprg=ag\ --nogroup\ --nocolor

  " Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
  let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'

  " ag is fast enough that CtrlP doesn't need to cache
  let g:ctrlp_use_caching = 0
endif
like image 110
Bibek Shrestha Avatar answered Jan 05 '23 01:01

Bibek Shrestha