您可以使用:vimgrep /pattern/ {files}匹配模式填充快速修复列表。问题在于:vimgrepfiles选项不能直接允许缓冲区。您可以使用:
%   Is replaced with the current file name.       *:_%* *c_%*
#   Is replaced with the alternate file name.     *:_#* *c_#*
#n  (where n is a number) is replaced with        *:_#0* *:_#n*
    the file name of buffer n.  "#0" is the same as "#".     *c_#n*
##  Is replaced with all names in the argument list   *:_##* *c_##*
    concatenated, separated by spaces.  Each space in a name
    is preceded with a backslash.
#<n (where n is a number > 0) is replaced with old    *:_#<* *c_#<*
    file name n.  See |:oldfiles| or |v:oldfiles| to get the
    number.                         *E809*
    {only when compiled with the |+eval| and |+viminfo| features}
另一个选择是编写一个脚本,从中生成文件列表:buffers。根据这个SO帖子,仅需t周的时间,我们将获得:
function! BuffersList()
  let all = range(0, bufnr('$'))
  let res = []
  for b in all
    if buflisted(b)
      call add(res, bufname(b))
    endif
  endfor
  return res
endfunction
function! GrepBuffers (expression)
  exec 'vimgrep/'.a:expression.'/ '.join(BuffersList())
endfunction
command! -nargs=+ GrepBufs call GrepBuffers(<q-args>)
现在:GrepBufs <expression>,您可以调用并获取标准:vimgrep输出,但可以使用缓冲区。
更新如果您要GrepBuffers使用光标下方的值进行调用,请添加此新映射。
nnoremap <leader>z :call GrepBuffers("<C-R><C-W>")<CR>
当您处于正常模式时<leader>z,将:vimgrep光标置于打开的缓冲区上。