以下の内容はhttps://www.pandanoir.info/entry/2021/04/10/081652より取得しました。


git branch を fzf で簡単に選択する in zsh

setopt no_flow_control
__fbr() {
  local item
  git branch | fzf +s +m -e --ansi --reverse --height 40% | sed -e 's/^ *//' -e 's/^\* //' | while read item; do
    echo -n "${(q)item} "
  done
  local ret=$?
  echo
  return $ret
}
fzf-branch-widget() {
  LBUFFER="${LBUFFER}$(__fbr)"
  local ret=$?
  zle reset-prompt
  return $ret
}
zle     -N   fzf-branch-widget
bindkey '^S' fzf-branch-widget

これで、Ctrl-sを押すとブランチ選択ウィンドウが立ち上がるようになります。かなり開発効率上がるのでオススメです。

(fzfのkey-bindings.zshを参考に書いただけで詳しい動作はあまり理解してないけど問題ないはず)




以上の内容はhttps://www.pandanoir.info/entry/2021/04/10/081652より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14