VIM: Search only between specific line numbers?

前端 未结 7 949
余生分开走
余生分开走 2020-12-13 09:06

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

7条回答
  •  一生所求
    2020-12-13 09:35

    Great answer from akira. But after some digging, I found an alternative. It's not as elegant but easier to type in:

     :12,24g/search/
    

    This will give you one annoying prompt but it will end up on the first line within the range containing the sought string.

提交回复
热议问题