dotfiles/fzf/git-completion.zsh

17 lines
390 B
Bash
Raw Normal View History

2020-05-24 10:55:20 +00:00
_fzf_complete_git() {
ARGS="$@"
local branches
branches=$(git branch --all --sort=-committerdate --format="%(refname:short)")
if [[ $ARGS == 'git co'* || $ARGS == 'git checkout'* || $ARGS == 'git merge'* ]]; then
_fzf_complete -- "$@" < <(
echo $branches
)
else
eval "zle ${fzf_default_compeltion:-expand-or-complete}"
fi
}
_fzf_complete_git_post() {
sed "s/^origin\///"
}