source_debug '. ~/.zsh/rc'
+# Warn when creating global variables from inside a function. Needs to be set
+# before declaring a function.
+setopt warn_create_global
+
+
# HELPER FUNCTIONS
# Return the name of the program which is called in the foreground with `fg`.
if [[ $ZSH_VERSION == (4.3.<11->*|4.<4->*|<5->*) ||
-d ~/.zsh/functions/vcs_info ]]; then
zstyle ':vcs_info:*' formats \
- "($green%b%u%c$default:$blue%s$default)"
+ "(${green}%b%u%c${default}:${blue}%s${default})"
zstyle ':vcs_info:*' actionformats \
- "($green%b%u%c$default/$red%a$default:$blue%s$default)"
+ "(${green}%b%u%c${default}/${red}%a${default}:${blue}%s${default})"
else
# In older versions %u and %c are not defined yet and are not
# correctly expanded.
zstyle ':vcs_info:*' formats \
- "($green%b$default:$blue%s$default)"
+ "(${green}%b${default}:${blue}%s${default})"
zstyle ':vcs_info:*' actionformats \
- "($green%b$default/$red%a$default:$blue%s$default)"
+ "(${green}%b${default}/${red}%a${default}:${blue}%s${default})"
fi
# Set style for formats/actionformats when unstaged (%u) and staged (%c)
# changes are detected in the repository; check-for-changes must be set to
# Is set to a non empty value to reset the window name in the next
# precmd() call.
zshrc_window_reset=yes
- # Is set to a non empty value when the shell is running as root.
- if [[ $UID -eq 0 ]]; then
- zshrc_window_root=yes
- fi
zshrc_window_preexec() {
# Get the program name with its arguments.
# Add an exclamation mark at the beginning if running with sudo or if
# running zsh as root.
- if [[ -n $program_sudo || -n $zshrc_window_root ]]; then
+ if [[ -n $program_sudo || $UID -eq 0 ]]; then
program_name=!$program_name
fi
fi
# Prepend prefixes like in window_preexec().
- if [[ -n $zshrc_window_root ]]; then
+ if [[ $UID -eq 0 ]]; then
name="!$name"
fi
if [[ -n $SSH_CONNECTION ]]; then