aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Ritter <dritter03@googlemail.com>2018-03-27 02:09:41 +0300
committerDominik Ritter <dritter03@googlemail.com>2018-03-27 02:33:21 +0300
commit9a895bc7e4c925658a9c57681437000445f399ed (patch)
tree8ed7d86bcb1cd9f40cea951a6f2afe9a6dd592a5
parent99f142de36630c141f7c8959563f15730b568b3c (diff)
Make variables local
-rwxr-xr-xfunctions/colors.zsh6
-rwxr-xr-xfunctions/utilities.zsh1
-rwxr-xr-xpowerlevel9k.zsh-theme6
3 files changed, 8 insertions, 5 deletions
diff --git a/functions/colors.zsh b/functions/colors.zsh
index f421165c..e98bfd4f 100755
--- a/functions/colors.zsh
+++ b/functions/colors.zsh
@@ -35,11 +35,11 @@ function getColor() {
fi
else
# named color added to parameter expansion print -P to test if the name exists in terminal
- named="%K{$1}"
+ local named="%K{$1}"
# https://misc.flogisoft.com/bash/tip_colors_and_formatting
- default="$'\033'\[49m"
+ local default="$'\033'\[49m"
# http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html
- quoted=$(printf "%q" $(print -P "$named"))
+ local quoted=$(printf "%q" $(print -P "$named"))
if [[ $quoted = "$'\033'\[49m" && $1 != "black" ]]; then
# color not found, so try to get the code
1=$(getColorCode $1)
diff --git a/functions/utilities.zsh b/functions/utilities.zsh
index a9559922..7451ebf0 100755
--- a/functions/utilities.zsh
+++ b/functions/utilities.zsh
@@ -39,6 +39,7 @@ printSizeHumanReadable() {
# if the base is not Bytes
if [[ -n $2 ]]; then
+ local idx
for idx in "${extension[@]}"; do
if [[ "$2" == "$idx" ]]; then
break
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index 8379f68a..030807f2 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -921,7 +921,7 @@ prompt_dir() {
fi
# declare variables used for bold and state colors
- local bld dir_state_foreground dir_state_user_foreground
+ local bld_on bld_off dir_state_foreground dir_state_user_foreground
# test if user wants the last directory printed in bold
if [[ "${(L)POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD}" == "true" ]]; then
bld_on="%B"
@@ -1685,6 +1685,7 @@ build_left_prompt() {
# Right prompt
build_right_prompt() {
local index=1
+ local element
for element in "${POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS[@]}"; do
# Remove joined information in direct calls
element=${element%_joined}
@@ -1707,6 +1708,7 @@ powerlevel9k_preexec() {
set_default POWERLEVEL9K_PROMPT_ADD_NEWLINE false
powerlevel9k_prepare_prompts() {
+ local RETVAL RPROMPT_PREFIX RPROMPT_SUFFIX
RETVAL=$?
RETVALS=( "$pipestatus[@]" )
@@ -1741,7 +1743,7 @@ $(print_icon 'MULTILINE_LAST_PROMPT_PREFIX')'
RPROMPT='$RPROMPT_PREFIX%f%b%k$(build_right_prompt)%{$reset_color%}$RPROMPT_SUFFIX'
fi
-NEWLINE='
+local NEWLINE='
'
if [[ $POWERLEVEL9K_PROMPT_ADD_NEWLINE == true ]]; then