Open mainrs opened 8 months ago
this is a nice feature I was actually not even aware of, thanks for the suggestion :)
@mainrs Added in #133 I cant figure out how to detect whether an abbreviation was used though as it automatically gets swapped before the command is entered So it basically will always show up.
@mainrs Added in #133 I cant figure out how to detect whether an abbreviation was used though as it automatically gets swapped before the command is entered So it basically will always show up.
Ahhh, I see what you mean. In fish (where I initially saw this), there seems to be a way to detect the raw user input . So it's possible to discern if the user used the abbreviation or the full command.
Hi I'm the zsh-abbr maintainer 👋
Teaching zsh-you-should-use about zsh-abbr abbreviations is a neat idea.
@mainrs thanks for spearheading and middlemanning.
@p1r473 cool stuff in #133. I think it can be done with fewer or maybe even no forks (that is, external commands)! For example, you can get more robustly handle the quotation marks with Q
or q
parameter expansion modifiers (docs), and you can get the abbreviation directly, without building an inverted array, with the pattern ${(k)association_haystack[(r)$value_needle]}
(r
subscript flag docs). Would be great to support global abbreviations that aren't the entire line. Heads up that the upcoming "prefixes" feature will complicate things. (I don't know zsh-you-should-use well enough to comment on the limit
and zstyle
changes.)
@MichaelAquilina if you're up for supporting zsh-abbr abbreviations, I'm up for taking on the work of exporting some additional variables with an eye towards minimizing the implementation in zsh-you-should-use.
Hey long time @olets
That would be great if you can add it in in a more official way :)
Thanks for the tips. Ive tried to incorporate them into my pull request now.
Here's a visual example of how its working now showing an abbreviation for ls -t
as list
@olets that sounds great! :) thanks for chiming in. Any variables that could serve as an "API" to zsh-abbr would be very helpful in making sure this feature works correctly and doesnt take a lot of effort to maintain.
What kind of variables do you have in mind?
What kind of variables do you have in mind?
One each for
If no opportunity to use an abbreviation was missed, they'd all be empty.
zsh-abbr
allows for the creation of fish-like abbreviations. These get substituted in-shell with the specified command and do appear inside the history as the substituted command.Repository: https://github.com/olets/zsh-abbr Related discussions: https://github.com/olets/zsh-abbr/discussions/51#discussioncomment-7354069