Seasons.NET

ちょっとした技術ブログです

vimgrepスクリプト

カーソルの下の用語を検索して、cwinで表示。
スクリプトちゃんと勉強してないので、手直しがどんどん入る予定。
勉強かねてます。。。

 1 
 2 function! s:GrepVimWord()
 3     let findwords = expand("<cword>")
 4     if findwords == ""
 5         echo "検索用語がありません"
 6         return
 7     end
 8     execute 'vimgrep ' . findwords . ' **/*.* | cwin'
 9 endfunction
10 
11 command! GrepVimWord call s:GrepVimWord()
12 
13 nmap <C-G> :GrepVimWord<Enter>