Adding a trigger command to autocomplete function in zsh
Posted
by
mkaito
on Super User
See other posts from Super User
or by mkaito
Published on 2012-06-02T09:01:23Z
Indexed on
2012/06/02
10:44 UTC
Read the original article
Hit count: 312
zsh
|autocomplete
When you define an alias like alias g=git
, the shell will pick it up and run the corresponding autocomplete function. Now, there's a program out there called hub
, which is basically a supserset of git, with some added, github-specific functionality. The recommended way to use hub
is to alias git=hub
. Of course, this won't trigger the autocomplete function for git, which makes sense.
Now, if I wanted to have git's autocomplete trigger for hub, the only way I know of is editing /usr/share/zsh/functions/Completion/Unix/_git
and adding hub
in the first line as trigger. While this works, it isn't practical, since this file will get overwritten with the next zsh release. Assuming hub won't provide a zsh completion function any time soon, is there another way of adding hub
to the trigger commands for git's autocomplete function?
© Super User or respective owner