Skip to content

Commit

Permalink
refactor: uppercasing global environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
DeveloperC286 committed Jan 26, 2024
1 parent 0c88281 commit d562b0a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/zsh-simple-abbreviations
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ __zsh_simple_abbreviations::expand() {
# Can't use KEY_REGEX, but should match it.
LBUFFER=${LBUFFER%%(#m)[-_a-zA-Z0-9]#}
# If matches set abbreviation add that else just add what we attempted to match on.
LBUFFER+=${${_zsh_simple_abbreviations[$MATCH]}:-$MATCH}
LBUFFER+=${${ZSH_SIMPLE_ABBREVIATIONS[$MATCH]}:-$MATCH}
# Causes the syntax highlighting.
zle self-insert
}
Expand All @@ -35,7 +35,7 @@ case $1 in
local value=${3}

if [[ "${key}" =~ ${KEY_REGEX} ]]; then
_zsh_simple_abbreviations[$key]="${value}"
ZSH_SIMPLE_ABBREVIATIONS[$key]="${value}"
else
echo "zsh_simple_abbreviations key '${key}' contains non-alphanumeric characters."
return 1
Expand All @@ -51,7 +51,7 @@ case $1 in
local key=${2}

if [[ "${key}" =~ ${KEY_REGEX} ]]; then
if [[ -n "${_zsh_simple_abbreviations[$key]}" ]]; then
if [[ -n "${ZSH_SIMPLE_ABBREVIATIONS[$key]}" ]]; then
unset "_zsh_simple_abbreviations[$key]"
else
echo "zsh_simple_abbreviations remove sub-command key does not match any abbreviations."
Expand All @@ -70,8 +70,8 @@ case $1 in
return 1
fi

for key in ${(ko)_zsh_simple_abbreviations}; do
echo "zsh_simple_abbreviations --add ${key} '${_zsh_simple_abbreviations[$key]}'"
for key in ${(ko)ZSH_SIMPLE_ABBREVIATIONS}; do
echo "zsh_simple_abbreviations --add ${key} '${ZSH_SIMPLE_ABBREVIATIONS[$key]}'"
done
;;

Expand Down
2 changes: 1 addition & 1 deletion zsh-simple-abbreviations.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Only run if executed in Zsh environment.
if [[ -n "${ZSH_VERSION}" ]]; then
# Create new abbreviations map.
typeset -Ag _zsh_simple_abbreviations
typeset -Ag ZSH_SIMPLE_ABBREVIATIONS

fpath+=${0:A:h}/src
autoload -Uz zsh-simple-abbreviations
Expand Down

0 comments on commit d562b0a

Please sign in to comment.