LoginSignup
12
10

More than 5 years have passed since last update.

peco-select-repository.fish がほしい

Last updated at Posted at 2015-03-24

peco-select-history を見て「clone してきたローカル リポジトリ一覧を見れたら便利だなあ」と思ったお話。

できた

もともと似たようなスクリプトを書いていたので流用した1

(追記: 2019/01/01) fish 3.0 つかおう

peco-select-repository.fish
function peco_select_repository
    ghq list -p | peco --select-1 | read -l line && builtin cd $line

    commandline -f repaint
end

関数を書いて bind しておけばなんとかなる。

bind -e -M insert \ce
bind -M insert \ce peco_select_repository

peco-select-history.fish

おまけ。似ているからすぐできた2

peco-select-history.fish
function peco_select_history
    if set -q $argv
        history | peco | read -l line && commandline $line
    else
        history | peco --query $argv | read -l line && commandline $line
    end

    commandline -f repaint
end
bind -e -M insert \cr
bind -M insert \cr peco_select_history

どっちも C^r に割り当てたいなあ…と思ってたけどモード使えばよかった。

よもやまばなし

ローカル リポジトリ一覧ほしい

ghq つかっていてよかった。

peco つかえるんだろうか

たぶん一番なやんだところ。書いたのはずいぶん前だからおぼえていないけど。

read つかって peco の戻り値を読んでる。たぶん Stack Overflow で見た。

実行したあと表示が更新されない

force-repaint、やってくれないのかな。

おわったら insert モードにしたい

bind -M MODE マニュアル読んでみるもんですな

peco の戻り値をコマンド ライン バッファに入れたい

commandline でできた、なんでもあるなあ

すでにあるけど

うう…

参考

12
10
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
12
10