如何在VIM中跨多个文件进行增量搜索?

6
Vim已经可以在当前打开的文件中进行增量搜索,但是你能在多个文件中进行增量搜索吗?
2个回答

1
据我所知,这是不可能的。但是你可以开始输入一个已打开缓冲区中的单词,并按下ctrl-xctrl-n来在所有已打开的缓冲区中搜索这个单词。

嗯噫...有点遗憾。不过我同意Ctrl-X Ctrl-N确实非常有用。 - Alex
抱歉,请不要使用Ctrl-X,只需按下Ctrl-N。Ctrl-X Ctrl-N仅在当前缓冲区中搜索,而Ctrl-N则在所有其他缓冲区中搜索。 - Benoit
我刚刚发现,将光标放在一个单词上并按*键,可以在文档中突出显示该单词的每个出现。 - Alex
并且使用#可以向后搜索。 - Benoit

-1

来自:help grepadd

                            *:grepa* *:grepadd*
:grepa[dd][!] [arguments]
            Just like ":grep", but instead of making a new list of
            errors the matches are appended to the current list.
            Example: >
                :call setqflist([])
                :bufdo grepadd! something %
            The first command makes a new error list which is
            empty.  The second command executes "grepadd" for each
            listed buffer.  Note the use of ! to avoid that
            ":grepadd" jumps to the first error, which is not
            allowed with |:bufdo|.
            An example that uses the argument list and avoids
            errors for files without matches: >
                                :silent argdo try 
                  \ | grepadd! something %
                  \ | catch /E480:/
                  \ | endtry"

我不确定这是否符合我的要求。即使它符合,我仍然无法弄清楚。具体来说,它不是增量搜索。(在Windows上,它只会生成一个findstr) - Alex

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接