4

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.

jbm
  • 1,482
  • 11
  • 26

2 Answers2

10

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
Bibek Shrestha
  • 32,848
  • 7
  • 31
  • 34
  • Thanks for the info. Up-rated, though giving amos the courtesy of the check for being earliest. – jbm Apr 01 '15 at 22:20
8

Try this one. Works for me. let g:ctrlp_user_command = 'ag -l --nocolor -g "" %s'

Amos
  • 3,238
  • 4
  • 19
  • 41