olets / zsh-abbr

The zsh manager for auto-expanding abbreviations, inspired by fish. ~13,000 unique cloners as of May '24, 580+ Homebrew installs 6/23-6/24
https://zsh-abbr.olets.dev
Other
511 stars 18 forks source link

`abbr c` does not clear abbreviations created with the pattern `abbr x=y` #88

Closed metruzanca closed 1 year ago

metruzanca commented 1 year ago

Is there an existing issue for this?

Update the issue title

Expected Behavior

When running abbr c / abbr clear-session I'm expecting all abbr to be wiped. My use case being to run abbr c; abbr import-aliases to get rid of old and add new aliases to abbr.

Actual Behavior

Screenshot 2023-04-19 at 11 59 47 AM

All other commands seem to work fine. The actual plugin works as expected, its just deleting the abbr which is tedious. I can delete with abbr erase <name>, just not abbr c.

Steps To Reproduce

Basic zsh install (no oh-my-zsh) w/ Zplug as the plugin manager running on MacOS ventura.

Environment

zsh-abbr version 5.0.1
zsh 5.9 (arm-apple-darwin22.1.0)
OSTYPE darwin22.0

Installation method

Other

Installation method details

brew tap "olets/tap"
brew install zplug olets/tap/zsh-abbr # & zsh of course

ZPlug setup

#!/usr/bin/env zsh
# as a part of your dotfiles setup/linking/stowing script
source /opt/homebrew/opt/zplug/init.zsh;
zplug "olets/zsh-abbr";
zplug install;
# .zshrc
source /opt/homebrew/opt/zplug/init.zsh;
zplug "olets/zsh-abbr";
zplug load;

Anything else?

No response

olets commented 1 year ago

clear-session clears all session abbreviations https://zsh-abbr.olets.dev/scopes.html#session (closing the terminal, or restarting zsh exec zsh does too)

If session abbreviations work for you, import aliases with abbr -S import-aliases. Then abbr c will clear them.

If you want to clear all user abbreviations, two good (though destructive) options are to delete everything from $ABBR_USER_ABBREVIATIONS_FILE

echo > $ABBR_USER_ABBREVIATIONS_FILE

or to delete the file

rm $ABBR_USER_ABBREVIATIONS_FILE
# or, if you want to be able to recover the file, use https://github.com/sindresorhus/trash-cli
olets commented 1 year ago

I'm taking that reaction as good news that this solved your issue. I updated the title to be more specific now that we know what the problem was. Thanks for bringing this up!

metruzanca commented 1 year ago

Yes sorry I forgot to finish my reply. This was exactly what i wanted. I'm moving my setup to use sessions now.

Thanks for the great reply and thanks for the great plugin.