I recently switched from bash to zsh and am using Prezto for basic setup. For a long time I've used this function:
function g() {
if [[ $# > 0 ]]; then
git $@
else
git status
fi
}
This allows me to use g
for git status
or g <command>
for any other git action.
The Prezto git module had an alias that was overriding my function
alias g='git'
So I commented this out and my function worked as expected. However the problem comes in when I need tab completion.
ex:
I have thus far been unable to marry using my function with the git completion modules so that I can do things like g checkout aw-<tab>
and have it show me the branch options.
I had this working fine in bash and would love to be able to have similar functionality in zsh.
Thank you in advance!
Add this to your
~/.zshrc
As explained here