Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Search 在所有VI缓冲区中查找/Grep_Search_Vim_Macvim - Fatal编程技术网

Search 在所有VI缓冲区中查找/Grep

Search 在所有VI缓冲区中查找/Grep,search,vim,macvim,Search,Vim,Macvim,由于打开了许多缓冲区,我需要一种简单的方法来搜索正则表达式的所有缓冲区并导航搜索结果(快速列表?) 我知道我可以使用:bufdo命令,并且很容易搜索并替换为%s,但是我找不到一种方法来进行简单的搜索,然后导航结果 我找到了相应的插件(例如buffergrep),但是如果这个简单的任务本机不支持vim技巧,我会感到惊讶。。是吗?将填充QuickFix缓冲区,它允许在结果之间进行快速导航。我找到了相应的插件(例如buffergrep),但是如果这个简单的任务本机不支持vim技巧,我会感到惊讶。是吗

由于打开了许多缓冲区,我需要一种简单的方法来搜索正则表达式的所有缓冲区并导航搜索结果(快速列表?)

我知道我可以使用
:bufdo
命令,并且很容易搜索并替换为
%s
,但是我找不到一种方法来进行简单的搜索,然后导航结果

我找到了相应的插件(例如buffergrep),但是如果这个简单的任务本机不支持vim技巧,我会感到惊讶。。是吗?

将填充QuickFix缓冲区,它允许在结果之间进行快速导航。

我找到了相应的插件(例如buffergrep),但是如果这个简单的任务本机不支持vim技巧,我会感到惊讶。是吗

据我所知没有。多个插件试图提供这一功能的存在倾向于证实

你尝试过哪些插件,它们缺少什么

http://www.vim.org/scripts/script.php?script_id=2545
http://www.vim.org/scripts/script.php?script_id=2255

另外,为了确保你知道vimgrep,对吗?Vimgrep是一个内部命令,它将文件加载到缓冲区中,并在缓冲区上执行grep操作,结果显示在quickfix窗口中。我还没有确认,但我假设如果搜索到的文件已经在缓冲区中打开,Vimgrep不会重新加载它,至少如果它设置了“nomodified”标志。如果是这样,使用Vimgrep快速轻松地进行缓冲区grepping的一种方法就是使用:buffers命令的输出为Vimgrep创建一个文件列表。

from
:help 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"

你能用它来grep缓冲区而不是files@Samer阿布哈伊特:文档建议
:调用setqflist([])| bufdo grepadd!一些%
,还有一些额外的工作来处理更多的案例。grepadd!看起来很有意思。文档不够清晰,无法将其映射到所需的行为或回答以下问题(语法元素是什么?和/或是否可以使用“%”以外的其他内容)。但在所有情况下,我现在都有办法做我想做的事,为此我感谢你们!对于已经加载的缓冲区,
vimgrep
而不是
grep
是更好的解决方案