Skip to content

Instantly share code, notes, and snippets.

@udzura
Created June 14, 2016 05:53
Show Gist options
  • Save udzura/2641db6e3ed0f07ff5545abd6effb8d7 to your computer and use it in GitHub Desktop.
Save udzura/2641db6e3ed0f07ff5545abd6effb8d7 to your computer and use it in GitHub Desktop.
function peco-git-checkout () {
local selected_branch=$(git branch --list --no-color | colrm 1 2 | peco)
if [ -n "$selected_branch" ]; then
BUFFER="git checkout ${selected_branch}"
zle accept-line
fi
}
zle -N peco-git-checkout
bindkey '^[;^[c' peco-git-checkout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment