> How would I search for a regex within a particular area? The text
> document is very long, and I don't want to match all instances, just
> those I care about. I would probably select the text visually.


If you happen to know the line numbers of your interesting
section, you can use

        /\<200l\>100lregexp

which will search for "regexp" as long as it falls between line
100 and line 200 (exclusive).

Alternatively, you can use something like

:vnoremap g/
<c-c>/<bslash>%><c-r>=line("'<lt>")-1<cr>l<bslash>%<lt><c-r>=line("'>")+1<cr>l


(all in one line) will prime the search line with the search
line-limiting.  This makes it a bit easier so that within a
visually selected range, type "g/" and then type your search
regexp after the prepopulated line.

This works for line-wise visual mode.  Character-wise and
block-wise get a whole lot hairier.

Hope this gives you some ideas,

-tim




Reply via email to