LoginSignup
0
0

More than 5 years have passed since last update.

ag(The Silver Searcher)で検索しpecoで更に絞り込みnanoで該当行を開く

Posted at

agとpecoとvimの組み合わせはあるのに、nanoがなさそうだったので。
けど、nanoさんあんまり需要ないのかな・・・

使ってる人あんまり見ないし、使ってたら珍しがられる。

.zshrc
function agnano () {
    nano $(ag $@ | peco --query "$LBUFFER" | awk -F : '{print "+" $2 " " $1}')
}

ポイント

nanoは nano +<行数> <file名> という引数を取るらしい。

だから、 '{print "+" $2 " " $1}' こうなる。

参考URL

https://qiita.com/fmy/items/b92254d14049996f6ec3
https://ubuntuforums.org/showthread.php?t=1005737

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