2011-08-23 36 views

回答

2

我使用的一个小功能,我把我的.vimrc里:

function! s:GrepOpenBuffers(search, jump) 
    call setqflist([]) 
    let cur = getpos('.') 
    silent! exe 'bufdo vimgrepadd /' . a:search . '/ %' 
    let matches = len(getqflist()) 
    if a:jump && matches > 0 
     sil! cfirst 
    else 
     call setpos('.', cur) 
    endif 
    echo 'BufGrep:' ((matches) ? matches : 'No') 'matches found' 
endfunction 
com! -nargs=1 -bang BufGrep call <SID>GrepOpenBuffers('<args>', <bang>0) 

您可以使用类似上面到grep在所有打开一个搜索词缓冲区。

+0

非常酷!如果只有它也可以跳到第一场比赛......可能是? – artemave

+0

@artemave跳到第一场比赛,你将不得不使用':BufGrep! search_term' – kongo2002

+0

太棒了!谢谢! – artemave

2
+0

好点!其实我已安装EasyGrep,也可以搜索缓冲区......但!所有* grep插件我在quickfix窗口中看到了打开的结果。我理想中想要的就是瞬间跳到(比如说第一个)比赛。就像'gf'或'tags'一样。 – artemave