Skip to content

Commit

Permalink
feat(erase): play nice with multi-word abbreviations
Browse files Browse the repository at this point in the history
  • Loading branch information
olets committed Nov 10, 2022
1 parent 284712d commit 2503546
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions zsh-abbr.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,14 @@ _abbr() {

if [[ $scope != 'user' ]]; then
if [[ $type != 'regular' ]]; then
if (( ${+ABBR_GLOBAL_SESSION_ABBREVIATIONS[${(qqq)abbreviation}]} )); then
if (( ${+ABBR_GLOBAL_SESSION_ABBREVIATIONS[${(qqq)${(Q)abbreviation}}]} )); then
(( ABBR_DEBUG )) && 'builtin' 'echo' " Found a global session abbreviation"
abbreviations_sets+=( ABBR_GLOBAL_SESSION_ABBREVIATIONS )
fi
fi

if [[ $type != 'global' ]]; then
if (( ${+ABBR_REGULAR_SESSION_ABBREVIATIONS[${(qqq)abbreviation}]} )); then
if (( ${+ABBR_REGULAR_SESSION_ABBREVIATIONS[${(qqq)${(Q)abbreviation}}]} )); then
(( ABBR_DEBUG )) && 'builtin' 'echo' " Found a regular session abbreviation"
abbreviations_sets+=( ABBR_REGULAR_SESSION_ABBREVIATIONS )
fi
Expand All @@ -166,7 +166,7 @@ _abbr() {
source ${ABBR_TMPDIR}global-user-abbreviations
fi

if (( ${+ABBR_GLOBAL_USER_ABBREVIATIONS[${(qqq)abbreviation}]} )); then
if (( ${+ABBR_GLOBAL_USER_ABBREVIATIONS[${(qqq)${(Q)abbreviation}}]} )); then
(( ABBR_DEBUG )) && 'builtin' 'echo' " Found a global user abbreviation"
abbreviations_sets+=( ABBR_GLOBAL_USER_ABBREVIATIONS )
fi
Expand All @@ -177,7 +177,7 @@ _abbr() {
source ${ABBR_TMPDIR}regular-user-abbreviations
fi

if (( ${+ABBR_REGULAR_USER_ABBREVIATIONS[${(qqq)abbreviation}]} )); then
if (( ${+ABBR_REGULAR_USER_ABBREVIATIONS[${(qqq)${(Q)abbreviation}}]} )); then
(( ABBR_DEBUG )) && 'builtin' 'echo' " Found a regular user abbreviation"
abbreviations_sets+=( ABBR_REGULAR_USER_ABBREVIATIONS )
fi
Expand All @@ -191,7 +191,7 @@ _abbr() {

if ! (( dry_run )); then
verb_phrase="Erased"
unset "${abbreviations_sets}[${(b)${(qqq)abbreviation}}]" # quotation marks required
unset "${abbreviations_sets}[${(b)${(qqq)${(Q)abbreviation}}}]" # quotation marks required

if [[ $abbreviations_sets =~ USER ]]; then
_abbr:util_sync_user
Expand Down

0 comments on commit 2503546

Please sign in to comment.