hgrep - recursive grep with hypertext links
perl "use hgrep"
and then provide responses to the ensuing prompts.
The hgrep module is used with [x]vile's perl interface to provide a nifty recursive grep facility complete with hypertext links.
One of the things which makes it so nifty is that it doesn't search binary files. (If you want it to, just search for and remove the -T in hgrep.pm.) So it's perfectly safe to just search * in most cases rather than using a restrictive filter like *.[hc]
Assuming that the hgrep extension has been loaded in your .vilerc file (see above), it may be invoked from the editor via
You will then need to answer questions at three prompts. The first is
Pattern to search for?
At the prompt, you should enter a regular expression. Some of the more useful patterns are
Search for string.
Search for word. Note that \b indicates a word boundary.
Search for the specified pattern, but ignore case.
See the perlre man page for more information about Perl regular expressions.
The second prompt is
Directory to search in?
By default, either . (the current working directory) or the last directory you entered will be displayed at this prompt. This is the directory hierarchy to be searched.
The third (and final prompt) is
File name pattern?
This should be a glob expression which indicates the names to search. By default it is * which means match all files. (Only text files as indicated by Perl's -T operator are searched however).
Once all three questions have been answered, hgrep will create a new buffer in which lines from files where matches occur are listed. The highlighted text matching the regular expression is a hypertext link which may be used to visit the places in the files corresponding to the matched text. These hypertext commands may be activated by double clicking in xvile or using the "execute-hypertext-command" command from vile. (See the Hypertext section of vile.hlp for some convenient key bindings.)
The error finder ^X^X (find-next-error) may also be used to quickly go to the next match in the list without returning to the hgrep buffer.