开发者

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 the开发者_C百科m. I tried the following, but it didn't help:

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

Thanks for your time!


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.


Adapting @jhwist solution, I find it easier to use markers remember to say 'n' to changes and not to go off the end

 :'a,'bs/extrascost//gc 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜