The alias I've used with success in bash but no longer works in Zsh looks like this
In .zshrc (previously .bashrc)
# custom git completions
_git_a ()
{
_git_add
}
_git_b ()
{
_git_branch
}
_git_c ()
{
_git_commit
}
_git_co ()
{
_git_checkout
}
.
.
.
# git alias function
g ()
{
arg1=$1
shift
case "$arg1" in
a)
eval git add $@;;
b)
eval git branch $@;;
c)
eval git commit -m \"$1\";;
co)
eval git checkout $@;;
.
.
.
*)
eval git $arg1 $@;;
esac
}
zstyle ':completion:*:*:git:*' script ~/.git-completions-mingit.bash
autoload -Uz compinit && compinit -u
source ~/.mingit.sh
compdef g='git'
It used to be the case (in bash) that typing something within the alias such as
g co<TAB><TAB>
would result in the same behavior as
git checkout<TAB><TAB>
but now (in Zsh) the result is that g co<TAB><TAB> cycles through folders and files in the directory. Is there a way to get the tab completion on g co or other g commands to work the same as git ... when it comes to tab completion?