Skip to content

Instantly share code, notes, and snippets.

@soh335
Created January 14, 2009 06:41
Show Gist options
  • Save soh335/46822 to your computer and use it in GitHub Desktop.
Save soh335/46822 to your computer and use it in GitHub Desktop.
"{{{
"Buffer全部から検索して結果をQuickFixに出力する
"http://ogijun.g.hatena.ne.jp/secondlife/20080310/1205128105
function Moregrep(word)
if exists("s:hasqf")
silent ccl
endif
cexpr '' " clear quickfix
let current = bufnr('%')
silent exec ':bufdo | try | vimgrepadd ' . '/' . a:word .'/j/' . ' % | catch | endtry'
silent exec ':b '. current
if !empty(getqflist())
silent cw
let s:hasqf = 1
else
echohl ErrorMsg
echomsg "no pattern" a:word
echohl None
return
endif
endfunction
command! -nargs=1 Moregrep :call Moregrep(<f-args>)
nmap <space>go :execute '.cc'<CR>
"}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment