Vim searching through all existing buffers

前端 未结 8 578
刺人心
刺人心 2021-02-01 13:23

When dealing with a single file, I\'m used to:

/blah
do some work
n
do some work
n
do some work

Suppose now I want to search for some pattern o

8条回答
  •  北荒
    北荒 (楼主)
    2021-02-01 14:07

    I don't believe it's possible to extend the 'n' functionanly across files or buffers. You could use

    :grep blah *
    

    And then do

    :cn
    

    To move to the next line with blah on it. That will switch between files but it's not quite as neat. It's more cumbersome to type the colon all the time, and it will only take you to the line, not the word.

    What I usually do is either to open the files I want to searched in tabs and then use 'n' and 'gt' to jump to next tab when I reach the end of the file, or list the files on the command line to I can skip to the next file with ':wn' when I'm done editing it.

    Hope it helps!

提交回复
热议问题