Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: uppercasing global environment variable #20

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading