djui/alias-tips

Expand aliases within commands to find alias tips

Closed this issue · 2 comments

Hi - thanks for the awesome plugin! I have an enhancement suggestion for you.

I use the oh-my-zsh git plugin, and I've already trained myself to always use g instead of git - which unfortunately means that alias-tips doesn't work for any git command that I type. (I assume because it doesn't expand g -> git before finding an alias matching the command.)

Here's an example:

→ repo:(master) g status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
→ repo:(master) git status
Alias tip: gst
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean

The relevant aliases from the git plugin:

alias g='git'
alias gst='git status'

Sounds tricky, but it would be really great if alias-tips expanded aliases inside commands.

Whoops - I just bothered to read the documentation and found ZSH_PLUGINS_ALIAS_TIPS_EXPAND. Works perfectly! Keep up the great work :)

djui commented

@wxactly Thanks for the kind words. As you figured out, the solution to this specific problem is using ZSH_PLUGINS_ALIAS_TIPS_EXPAND. We introduced it as a flag as it was considered experimental. But by now I think it has matured enough and is the expected behaviour therefore I will make it the default with the option to fallback.

Also make sure do check by again tomorrow, after I merged #16 which will allow multiple replacement runs and do allow better use cases with git aliases:

$ which g
g: aliased to git

$ git-alias
st = status -sb

$ git status -sb
Alias tip: g st