Search only between specific line numbers?

Viewed 30531

I know that with Vim's substitution command you can specific a range of lines:

:12,24s/search/replace

I want to be able to specify a range with normal searches as well. Something like

:12,24/search

Since that doesn't seem to work (at least on my Vim configuration), does anybody know how to achieve this?

7 Answers

If you would like to search to the end of the file, use $:

:3,$s/pattern//gn

This will search from 3-d line to the end

Related