LoginSignup
6
0

More than 3 years have passed since last update.

fzf.vimでAgを用いた文字列検索をする際、ファイル名とのマッチングを除外する

Posted at

fzf.vim にデフォルトで用意されているAgコマンドでの文字列検索は、ファイル名と検索文字列のマッチングも表示される。

スクリーンショット 2019-09-02 22.44.27.png

本文とのマッチングを見たいとき困る…

解決策

Agコマンドにオプションを付けることで、ファイル名とのマッチングを除外することができる。
.vimrc で以下のコードを書くことでコマンドを再定義できる。

vimrc
command! -bang -nargs=* Ag call fzf#vim#ag(<q-args>, {'options': '--delimiter : --nth 4..'}, <bang>0)

スクリーンショット 2019-09-02 22.43.20.png

本文とのマッチングだけ表示されるようになった。

参考
https://github.com/junegunn/fzf.vim/issues/609

6
0
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
6
0