Git completion with aliases

8

1

I have a convenient dotfiles repo on Github for you all to look at, here. FYI, git is installed via Homebrew, as with most of the executables on my system.

My git-completion in zsh works fine when I use no aliases, such as:

% git add fi<TAB> # => file.rb

But if I add an alias in my .zshrc (actually cormacrelf-dotfiles-repo/zsh/aliases.zsh), like:

alias ga="git add"
compdef _git ga=git-add

... trying to complete anything (not just files: branches, etc.) results in an error:

% git add fi
_git:19: parse error: condition expected: 1

zelk

Posted 2012-04-22T05:29:54.317

Reputation: 183

Did you try "git add fi<tab>' or 'ga <tab>'. Question sounds confusing. – Cougar – 2012-05-28T08:06:39.403

Answers

8

setopt no_complete_aliases in your .zshrc. Yes I know, the name sounds wrong, but that works.

Pierre Carrier

Posted 2012-04-22T05:29:54.317

Reputation: 896

Legend! This seems to work for me. – zelk – 2012-07-06T11:31:39.170