Open Chekote opened 6 months ago
Thanks for the report!
I'm able to replicate this. Added breaking tests in the new branch ~ 118-caret
~ ~edit: now named118-failed-erasure
~ edit: now named issues/118
. The caret ^
is the source of the problem. Possible they'll have to be disallowed. For now, a workaround is to not use carets in abbreviations.
- $ abbr a^='echo "Do something"'
+ $ abbr a='echo "Do something"'
You'll need to manually delete the a^
abbreviation from the user abbreviations file (see https://github.com/olets/zsh-abbr/discussions/119)
Thanks for the quick response ❤️
This also happens with the exclamation mark. I am migrating from Fish to Zsh, and these are the abbreviations that I have set up from Fish. If at all possible, it would be ideal if these could be supported so I don't have to retrain my dumb brain 😆
Thanks for updating the title. I got confused by the output of abbr and thought Added the regular user abbreviation
said Added the regular expression abbreviation
. My dumb brain assumes "regular" is always followed by "expression" 🤦
I just discovered something interesting:
If I add the following abbreviation:
abbr dcr!='docker container run --rm'
It ends up in the user file as:
abbr "dcr\!"="docker container run --rm"
Which doesn't expand properly in the shell. But if I edit the user file to remove the backslash:
abbr "dcr!"="docker container run --rm"
Then it works as expected.
But if I add another abbreviation via the abbr
command, it adds the backslash back in.
If at all possible, it would be ideal if these could be supported so I don't have to retrain my dumb brain
I hear that!
Will look into the caret. But heads up that it'll be at least a few days before I have time to investigate, maybe longer.
This also happens with the exclamation mark.
Good find! I can replicate. Updating the title and adding a failing test
I just discovered something interesting [escaped exclamation point]
But if I add another abbreviation via the abbr command, it adds the backslash back in.
Expected, that's because the full file is rewritten.
Thanks for updating the title
No worries! I don't feel users should have to use or know jargon.
Abbreviations with quotation marks also can't be deleted.
Looks relevant https://unix.stackexchange.com/a/626529/248959
Is there an existing issue for this?
Update the issue title
Expected Behavior
The abbreviation should be deleted.
Actual Behavior
zsh-abbr claims the abbreviation was deleted, but it is not.
Steps To Reproduce
Add the abbreviation:
Run the abbreviation:
Notice the abbreviation runs as expected.
Delete the abbreviation:
Try to run the abbreviation
Notice that it runs, even those zsh-abbr claimed it was erased.
Environment
Installation method
Homebrew
Installation method details
Homebrew 4.3.0-20-g1f603d3
Anything else?
No response