wklken / k-vim

vim配置
4.9k stars 1.81k forks source link

使用ag作为CrtlP的搜索引擎 #44

Closed dd1994 closed 9 years ago

dd1994 commented 10 years ago

ag速度暴快 参考:https://github.com/thoughtbot/dotfiles/blob/master/vimrc https://github.com/ggreer/the_silver_searcher

" 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

我觉得这是个非常好的设置,不搜索.gitignore里面忽略的文件,不用缓存。 我就不提pull requests了哈

wklken commented 10 years ago

我会安装使用一段时间, 没问题的话加入到现有版本 thx:)

kdurant commented 9 years ago

@dd1994 @wklken

let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'

会输出ERR: pcre_compile failed at position 8. Error: PCRE does not support /L, /l, /Nname, /U, or /u

我是windows系统,用的是编译好的ag.exe

wklken commented 9 years ago

ag用了一段(centos/mac, 不用win好久了......), 现在转到使用dyng/ctrlsf.vim, 这个用起来更像sublimetext的全局搜索

你这个可以执行ag.exe查看当前安装版本支持的参数


目前ag未加入的原因是, 要单独安装ag, 虽然可以通过检测决定是否使用, 但是例如ag.vim, 和dyng/ctrlsf.vim 这类好用的插件, 不好设为默认

wklken commented 9 years ago

我现在一直在用, 配合Bundle "dyng/ctrlsf.vim" 很赞 只是因为涉及到安装ag, 还在犹豫要不要配置进来

dd1994 commented 9 years ago

其实本来就有很多依赖了,比如那个 YCM 依赖那么多,其实再加个依赖也无所谓,而且 ag 安装也很方便...