However, I quickly became annoyed at the lack of column number
information, which prevents vim from jumping to the actual matched
text.
So, to remedy the situation, I patched Ack.pm to support a new
--column option and to print the column number along with the line
number like so:
$ ack -H --text --column line somefile.txt
somefile.txt
1:6:some line matched
2:12:some other line matched
The change is pretty simple, but I'm new to ack and I'm not sure of
the full implications of this change. Hopefully this, or a similar
patch can be included to improve support for vim (and probably other
text editors as well).
NOTE: the patch is against version 1.86
--
eric
That sounds very useful. I've also integrated ack into vim:
http://use.perl.org/~Ovid/journal/36430
As a quick hack, I jump to the matched text with:
execute "/\\v" . pattern
If you use simple Perl regular expressions, this will allow vim to
usually jump directly to the first match it finds (see "help \v" in
vim).
Cheers,
Ovid
I took a quick look at your integration and it looks like it doesn't
integrate with vim's quickfix. It seems to concentrate on finding one
file at a time.
While this may satisfy your workflow quite well, my primary usage
takes heavy advantage of vim's quickfix support where I want to be
able to navigate around all matches. The patch I submitted makes such
usage much more pleasant as it allows :cnext, :cprev, etc. to place
the cursor directly on the match.
Hopefully the powers that be will consider the patch for mainline
integration.
--
eric
> While this may satisfy your workflow quite well, my primary usage
> takes heavy advantage of vim's quickfix support where I want to be
> able to navigate around all matches. The patch I submitted makes such
> usage much more pleasant as it allows :cnext, :cprev, etc. to place
> the cursor directly on the match.
I don't understand. Are you talking about a patch to vim, or
something we should be doing in ack?
--
Andy Lester => an...@petdance.com => www.petdance.com => AIM:petdance
My original mail[1] includes a patch[2] to ack to allow it to print
the column number along with the line number for each match found.
The main motivation being integration with vim, but I would assume
that other editors could take advantage of the additional information
as well.
[1] http://groups.google.com/group/ack-users/browse_thread/thread/562cb329d515d2
[2] http://ack-users.googlegroups.com/attach/d876aa71645f7fbf/Ack.pm.diff?view=1&part=2
--
eric