Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

hanekomu (8123)

hanekomu
  (email not shown publicly)
http://hanekomu.at/blog/
AOL IM: hanekomu (Add Buddy, Send Message)

Go (Baduk) player and Perl hacker.

Journal of hanekomu (8123)

Tuesday October 23, 2007
01:50 PM

Using ack for vim's :grep

[ #34741 ]

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.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.