djui / alias-tips

An oh-my-zsh plugin to help remembering those aliases you defined once
786 stars 50 forks source link

Prefer the shortest command when there are multiple possible aliases #62

Open apaatsio opened 2 years ago

apaatsio commented 2 years ago

Let's define two "overlapping" aliases (I'm using these via https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git)

alias g='git'
alias gsta='git stash save'

Current behavior

$ git stash save                                                                                                          
Alias tip: g stash save

Preferred behavior

$ git stash save                                                                                                          
Alias tip: gsta

gsta is 4 characters and g stash save is 12 characters, so gsta should be preferred.

mrienstra commented 2 years ago

@djui, are you open to a PR for this? Tempted to work on it when I have time. Er, unless @apaatsio is hoping to do so, I don't want to deprive anyone of fun times.

apaatsio commented 2 years ago

@mrienstra Please, go ahead and have fun.

djui commented 2 years ago

@mrienstra Yes ofc! 🙏