2011-08-23 83 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