How do we restrict the search to a specific part of the text referred in basic row-coiumn positioning mainly (and visual selection, an extra way, if one would give) on (neo)vim just like substitution
:9,99s/foo/FOO
Try :9,99/foo
can't work as it does over the current file on buffer
So do n
next search will not restricted to line 99 and not get wrapped around back to line 9 after search that
:help :/
is unaffected by ranges because it is itself a "range" (an "address", actually). Using it for search is a bit of an anti-pattern.
And :help /
, which would be more correct, doesn't take a range anyway.
What you can do, though, is use the special atoms :help \%>l
and :help \%<l
directly in your regular expression pattern:
/\%>9lclassName\%<12l
where className
will be matched if it is found:
\%>9l
,\%<12l
.Vim's regular expression flavor has lots of atoms like the ones above that are specific to the context of an interactive text editor. See :help pattern-atoms
.