Closed akefirad closed 3 years ago
Good question, and one that I have been asking myself for quite some time.
As far as I understand things, the answer is yes and no.
g c
should use the same aliases as git commit
g c
is git commit
, since the commands defined in each alias may be more complex, as evident in my alf conf - and even if it does, there is no single, standard command (cross shell, cross program) to say "append these completions to my sub alias".As I am sure you already know, completion is a rather complex subject. It differs between shells, and each program comes with usually rather long completion scripts.
Ideally, when using alf, I would like to be able to state that:
g
means git
and therefore should show a) alf sub-aliases together with b) completions for the git
command itselfg c
means git commit
and should show the same completions as the original command.I do not know of a standard (cross-shell, cross program) way of doing so. If there was, then we could have added some config to alf so that users can make these statements in a configuration syntax, and alf would take care of the mechanics.
I have seen some one-liner commands in your zsh-in-docker image (in some of the config files) that did such tricks, for example:
# ~/.oh-my-zsh/plugins/git/git.plugin.zsh
compdef _git ggpnp=git-checkout
So bottom line:
Thoughts?
I'm not a bash pro, so I trust your evaluation. Thanks.
Currently the auto-complete suggests only and only the sub commands defined for a command, even if you already typed a sub-commands. For example if you type
g s
(i.e.git status
), pressing tab shows the same aliases defined by alf. Following this issue, is it possible to merge the list of suggestions provided by alf the existing one (provided by zsh or other source). What's talking about is exactly the way git works. If you define an alias as a sub-commend you'd still get the original suggestion in addition to the defined aliases. Does that make sense to you?