-source_debug ". ~/.zsh/rc"
+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
# Return the name of the program which is called in the foreground with `fg`.
# $1 is the name of the program (optional). If it's not 'fg' or 'fg *' it's
# returned unchanged.
# Return the name of the program which is called in the foreground with `fg`.
# $1 is the name of the program (optional). If it's not 'fg' or 'fg *' it's
# returned unchanged.
# $REPLY is used by convention for scalars ($reply for arrays) to return
# values from functions. unset it here to prevent problems when REPLY is
# bound to an integer or similar. Thanks to Mikachu in #zsh on Freenode
# $REPLY is used by convention for scalars ($reply for arrays) to return
# values from functions. unset it here to prevent problems when REPLY is
# bound to an integer or similar. Thanks to Mikachu in #zsh on Freenode
# Make sure every entry in $fpath is unique.
typeset -U fpath
# ~/.zsh/functions/completion is a symbolic link to the Completion directory
# Make sure every entry in $fpath is unique.
typeset -U fpath
# ~/.zsh/functions/completion is a symbolic link to the Completion directory
# returned. Very useful to get old commands quickly - in addition to the
# history commands (!..). Thanks to Mikachu in #zsh on Freenode (2010-01-17
# 12:47 CET) for the information how to a use function with bindkey.
# returned. Very useful to get old commands quickly - in addition to the
# history commands (!..). Thanks to Mikachu in #zsh on Freenode (2010-01-17
# 12:47 CET) for the information how to a use function with bindkey.
local not_at_beginning_of_line
if [[ $CURSOR -ne 0 ]]; then
not_at_beginning_of_line=yes
local not_at_beginning_of_line
if [[ $CURSOR -ne 0 ]]; then
not_at_beginning_of_line=yes
bindkey -a '^P' history-beginning-search-backward # binding for Vi-mode
# Here only Vi-mode is necessary as ^P enters Vi-mode and ^N only makes sense
# after calling ^P.
bindkey -a '^P' history-beginning-search-backward # binding for Vi-mode
# Here only Vi-mode is necessary as ^P enters Vi-mode and ^N only makes sense
# after calling ^P.
if [[ $ZSH_VERSION == (4.3.<11->*|4.<4->*|<5->*) ||
-d ~/.zsh/functions/vcs_info ]]; then
zstyle ':vcs_info:*' formats \
if [[ $ZSH_VERSION == (4.3.<11->*|4.<4->*|<5->*) ||
-d ~/.zsh/functions/vcs_info ]]; then
zstyle ':vcs_info:*' formats \
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
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
# Default to run vcs_info. If possible we prevent running it later for
# speed reasons. If set to a non empty value vcs_info is run.
# Default to run vcs_info. If possible we prevent running it later for
# speed reasons. If set to a non empty value vcs_info is run.
# If the shell just started up or we changed directories (or for other
# custom reasons) we must run vcs_info.
# If the shell just started up or we changed directories (or for other
# custom reasons) we must run vcs_info.
echo -n "${fg[default]}"
echo "\a" # send bell
fi
# Clear status. Prevents displaying old status information when pressing
# enter with an empty command line.
echo -n "${fg[default]}"
echo "\a" # send bell
fi
# Clear status. Prevents displaying old status information when pressing
# enter with an empty command line.
# Set the prompt. A two line prompt is used. On the top left the current
# working directory is displayed, on the right vcs_info (if available) and the
# Set the prompt. A two line prompt is used. On the top left the current
# working directory is displayed, on the right vcs_info (if available) and the
# Regex to remove elements which take no space. Used to calculate the
# width of the top prompt. Thanks to Bart's and Adam's prompt code in
# Functions/Prompts/prompt_*_setup.
local zero='%([BSUbfksu]|([FB]|){*})'
# Call vcs_info before every prompt.
# Regex to remove elements which take no space. Used to calculate the
# width of the top prompt. Thanks to Bart's and Adam's prompt code in
# Functions/Prompts/prompt_*_setup.
local zero='%([BSUbfksu]|([FB]|){*})'
# Call vcs_info before every prompt.
PROMPT="${top_prefix}${top_left}${top_separator}${top_right}
${bottom_prefix}${user}@${host} ${background}%# ${exitcode}"
}
PROMPT="${top_prefix}${top_left}${top_separator}${top_right}
${bottom_prefix}${user}@${host} ${background}%# ${exitcode}"
}
-# When screen, tmux, xterm or rxvt is used set the name of the window to the
-# currently running program.
+# When GNU screen, tmux, xterm or rxvt is used set the name of the window to
+# the currently running program.
#
# When a program is started preexec() sets the window's name to it; when it
# stops precmd() resets the window's name to 'zsh'. 'fg' is supported and sets
# the window's name to the resumed job.
#
#
# When a program is started preexec() sets the window's name to it; when it
# stops precmd() resets the window's name to 'zsh'. 'fg' is supported and sets
# the window's name to the resumed job.
#
#
# If a command is run with sudo or if the shell is running as root then a ! is
# added at the beginning of the command to make this clear. If a command is
#
# If a command is run with sudo or if the shell is running as root then a ! is
# added at the beginning of the command to make this clear. If a command is
if [[ $TERM == screen* || $TERM == xterm* || $TERM == rxvt* ]]; then
# Is set to a non empty value to reset the window name in the next
# precmd() call.
if [[ $TERM == screen* || $TERM == xterm* || $TERM == rxvt* ]]; then
# Is set to a non empty value to reset the window name in the next
# precmd() call.
- # Sets the window title. Works with screen, tmux (which uses screen as
- # TERM), xterm and rxvt. (V) escapes all non-printable characters. Thanks
+ # Sets the window title. Works with GNU screen, tmux (which uses screen as
+ # TERM), xterm and rxvt. (V) escapes all non-printable characters, thanks
alias -g L='2>&1 | less'
alias -g LS='2>&1 | less -S' # -S prevents wrapping of long lines
alias -g D='2>&1 | colordiff | less'
alias -g L='2>&1 | less'
alias -g LS='2>&1 | less -S' # -S prevents wrapping of long lines
alias -g D='2>&1 | colordiff | less'
# is empty. I open so much windows that I don't know in which I have something
# important. This helps me to remember which windows are empty (I run clear
# after I finished my work in a window).
# is empty. I open so much windows that I don't know in which I have something
# important. This helps me to remember which windows are empty (I run clear
# after I finished my work in a window).
-if [[ -n $window_reset ]]; then
- alias clear='clear; window_reset=yes; window_precmd reset'
+if [[ -n $zshrc_window_reset ]]; then
+ alias clear='clear; zshrc_window_reset=yes; zshrc_window_precmd reset'
fi
# LOAD ADDITIONAL CONFIGURATION FILES
# Configuration option for rc.local to use GNU screen/tmux. By default GNU
fi
# LOAD ADDITIONAL CONFIGURATION FILES
# Configuration option for rc.local to use GNU screen/tmux. By default GNU
# through ssh.
if [[ $TERM != dumb && $TERM != linux && -z $STY && -z $TMUX ]]; then
# Get running detached sessions.
# through ssh.
if [[ $TERM != dumb && $TERM != linux && -z $STY && -z $TMUX ]]; then
# Get running detached sessions.
session=$(tmux list-sessions 2>/dev/null \
| sed '/(attached)$/ d; s/^\([0-9]\{1,\}\).*$/\1/; q')
fi
# As we exec later we have to set the title here.
session=$(tmux list-sessions 2>/dev/null \
| sed '/(attached)$/ d; s/^\([0-9]\{1,\}\).*$/\1/; q')
fi
# As we exec later we have to set the title here.
- if [[ $use_multiplexer = screen ]]; then
- window_preexec "screen"
- elif [[ $use_multiplexer = tmux ]]; then
- window_preexec "tmux"
+ if [[ $zshrc_use_multiplexer = screen ]]; then
+ zshrc_window_preexec screen
+ elif [[ $zshrc_use_multiplexer = tmux ]]; then
+ zshrc_window_preexec tmux
# cases it doesn't work, the E alias can be used as workaround.
#
# Moved in the "run commands" section to prevent one unnecessary zsh process
# cases it doesn't work, the E alias can be used as workaround.
#
# Moved in the "run commands" section to prevent one unnecessary zsh process