LoginSignup
14

More than 5 years have passed since last update.

zsh + peco + anyframe 試した

Posted at

はよ

流れ

  1. zsh でインクリメンタルでべんりなやつたくさんあるけど他のやつ試したい
  2. peco 人気あるぽい
  3. peco と zsh 組み合わせたい
  4. zsh でみんな関数書いてキーバインディングつけてるぽい
  5. なんかそこつないでくれるいい感じのやつあるのでは
  6. mollifier さんが mollifier/anyframe というの作ってくれてた
  7. 良さそう

anyframe でできること

anyframeを使おう から抜粋したり補足したりする。

ぜんぶインクリメンタルなかんじの操作でできる。

コマンドライン履歴

ないと困るやつ。

  • 履歴一覧 ⇒ 選択 ⇒ 実行 ** anyframe-widget-execute-history
  • 履歴一覧 ⇒ 選択 ⇒ コマンドラインに挿入 ** anyframe-widget-put-history

ただ今回試したとき、選択後に

      1    vim ~/.zshrc                                                                                                                               
cd:cd:13: too many arguments

みたいに選択した履歴が渡されてきて、エラーになってて、原因どこだろうと思って探してみてる途中

Git ブランチ

git のブランチがずらーっと増えてきたとき助かる。
issue 番号なんとなくしか覚えてないときあるし。

ブランチ一覧 ⇒ 選択 ⇒ checkout

  • anyframe-widget-checkout-git-branch

ブランチ一覧 ⇒ 選択 ⇒ コマンドラインに挿入

  • anyframe-widget-insert-git-branch

過去に移動したことのあるディレクトリ一覧 ⇒ 選択 ⇒ 移動

  • anyframe-widget-cdr
  • required cdr

プロセス一覧 ⇒ 選択 ⇒ kill

  • anyframe-widget-kill

ghq で管理してるリポジトリ一覧 ⇒ 選択 ⇒ 移動

  • anyframe-widget-cd-ghq-repository
  • require motemen/ghq

ファイル名一覧 ⇒ 選択 ⇒ コマンドラインに挿入

  • anyframe-widget-insert-filename

自分で関数を追加する

べんりに追加しやすいとのこと。

インストールと設定

ここは端折って書くのでちゃんとこれ読むといいです。
mollifier/anyframe

zsh のプラグイン管理に antigen 使ってるならこれだけで導入終わる。

~/.zshrc
autoload -Uz chpwd_recent_dirs cdr add-zsh-hook
add-zsh-hook chpwd chpwd_recent_dirs

     :

antigen bundle mollifier/anyframe

あとキーバインド設定。

~/.zshrc
bindkey '^xb' anyframe-widget-cdr
bindkey '^x^b' anyframe-widget-checkout-git-branch

bindkey '^xr' anyframe-widget-execute-history
bindkey '^x^r' anyframe-widget-execute-history

bindkey '^xi' anyframe-widget-put-history
bindkey '^x^i' anyframe-widget-put-history

bindkey '^xg' anyframe-widget-cd-ghq-repository
bindkey '^x^g' anyframe-widget-cd-ghq-repository

bindkey '^xk' anyframe-widget-kill
bindkey '^x^k' anyframe-widget-kill

bindkey '^xe' anyframe-widget-insert-git-branch
bindkey '^x^e' anyframe-widget-insert-git-branch

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
14