Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Limit the Search Scope in VI/VIM?

Find and replace scope can be limited like this:

:16,256s/search_term/replacement/gc

I don't want to replace my search term with any other text, I just want to find them. I tried the following, but it didn't help:

:16,256/search_term # Notice that there is no 's' here

Thanks for your time!

like image 359
Srikanth Avatar asked Feb 03 '10 13:02

Srikanth


1 Answers

From the vim documentation:

You can limit the search command "/" to a certain range of lines by including \%>l items. For example, to match the word "limit" below line 199 and above line 300: >

/\%>199l\%<300llimit

This means: Match below line 199 and before line 300 and find the word limit.

like image 57
jhwist Avatar answered Sep 25 '22 00:09

jhwist