Conditional abbreviations #158
Unanswered
rbhanot4739
asked this question in
Q&A
Replies: 1 comment 1 reply
-
|
Interesting question! Three solutions come to mind: Put the condition in the abbreviated command itself (wrapping the % abbr ls='command -v eza && { eza -I "*pyc*" $eza_params } || ls'Or use the standard command as a fallback ( % abbr ls='eza -I "*pyc*" $eza_params 2>/dev/null || ls'Or conditionally add session abbreviations when the shell starts: # .zshrc
# load zsh-abbr and then
if …; then
abbr -S …
fi |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Thank you for the amazing plugin, and it works really well. Just wondering if its possible to add certain abbreviations only if the command exists. For example, this is what I have in my aliases file
However, when I import these aliases into abbreviations, this logic isn't respected automatically (which is acceptable and not a big deal). So is it possible to add such
if/elseconditions in the$ABBR_USER_ABBREVIATIONS_FILEand have an abbreviation defined based on that ?Beta Was this translation helpful? Give feedback.
All reactions