Windows 的正确 Vim/Ag g:ctrlp_user_command 值是多少?

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

我想在下面的 .vimrc 部分填写 elsif,谁能帮助我正确的 Windows 语法?

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

Unix 版本在我的 Windows gvim 中不工作。

试试这个。为我工作。 let g:ctrlp_user_command = 'ag -l --nocolor -g "" %s'

除了@amos 的回答之外,您实际上可以添加更多内容以在 CtrlP 中使用 ag,如前所述 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