LoginSignup
9
9

More than 5 years have passed since last update.

Unite.vimのgrepでjvgrepを使う

Last updated at Posted at 2015-11-05

はじめに

unite.vimのgrep検索にhighwayを使うという記事があったのですが、jvgrepは安定して早い #宣伝乙とのことだったのでjvgrepを使うことにしてみました。

jvgrepのインストール

jvgrepはgo製なのでgoの環境構築さえしてあれば、go getでインストールできます。

go get github.com/mattn/jvgrep

macの人はbrewでもインストール可能です。

brew install jvgrep

.vimrcの設定

.vimrcに下記設定を記載してください。

.vimrc
" grep検索のショートカット
nnoremap <silent> ,g  :<C-u>Unite grep:. -buffer-name=search-buffer<CR>

" unite grepにjvgrepを使う
if executable('jvgrep')
    let g:unite_source_grep_command = 'jvgrep'
    let g:unite_source_grep_default_opts = '-r'
    let g:unite_source_grep_recursive_opt = '-R'
endif

.git系のファイルはデフォルトで検索しないようになっているので、そこだけ注意してください(検索対象にすることはほぼないと思いますが)。

使い方

あとはノーマルモードで,gを入力すると、コマンドラインに

Pattern: 

と表示されるので、grepしたい文言を入力してEnterすればjvgrepを使って検索してくれます。
べんり。

9
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
9