Hi! Please consider following me on twitter: @hanekomu.
2007年10月23日
Using ack for vim's :grep
If you want the power of Perl regular expressions in with vim's :grep command, put this line into your .vimrc:
set grepprg=ack\ --nocolor\ --nogroup\ '$*'\ *\ /dev/null
Now you can use ack from within vim like this:
:grep some search.*string
If you want to be able to move through the results (opening each one in the
editor on the line the result occurred), add these lines to your
.vimrc:
nmap <C-v><C-n> :cnext<CR> imap <C-v><C-n> <Esc><C-v><C-n> nmap <C-v><C-p> :cprev<CR> imap <C-v><C-p> <Esc><C-v><C-p>
Now <C-v><C-n> will go to the next search result,
both from command and insert mode, and <C-v><C-p> will
go to the previous search result.
posted at: 09:50 | path: /dev | permalink | 0 comments | 0 trackbacks
Comments are closed for this story.
Trackbacks are closed for this story.