Here is how I do it on my Mac:
1. Install File-Next
2. Install ack
3. Edit your vimrc, add:
set grepprg=ack
4. Create a ack.vim in your .vim/plugin/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" all credits to antoine, | |
" more details see: http://blog.ant0ine.com/2007/03/ack_and_vim_integration.html | |
function! Ack(args) | |
let grepprg_bak=&grepprg | |
set grepprg=ack\ -H\ --nocolor\ --nogroup | |
execute "silent! grep " . a:args | |
botright copen | |
let &grepprg=grepprg_bak | |
endfunction | |
command! -nargs=* -complete=file Ack call Ack(<q-args>) |
Fire up your vim:
:Ack text_to_search_in_current_path
No comments:
Post a Comment