# skip customization for non-interactive shells if [[ ! -o interactive ]]; then return fi # completion system autoload -U compinit; compinit # retrieve information from version control systems autoload -Uz vcs_info # Offers menu when > selected elements appear zstyle ':completion:*' menu select # Specify enabled vcs backends zstyle ':vcs_info:*' enable git # Specify how it should be formatted zstyle ':vcs_info:*' formats '%b' # Make cd push the old directory onto the directory stack setopt AUTO_PUSHD # Exchanges the meanings of "+" and "-" when used with a number to specify a directory in the stack setopt PUSHD_MINUS # Do not print the directory stack after pushd or popd setopt PUSHD_SILENT # Do not push copies of the directory onto the directory stack setopt PUSHD_IGNORE_DUPS # The maximum size of the directory stack (no limit by default) DIRSTACKSIZE=8 # Remove command lines from the history list when the first character on the line is a space setopt HIST_IGNORE_SPACE # When writing out the history file, older commands that duplicate newer ones are omitted setopt HIST_SAVE_NO_DUPS # Enable vcs_info setopt PROMPT_SUBST # Comfortable aliases alias ..='cd ..' alias cp='cp -v' alias g='git' alias gc='g commit' alias gd='g diff' alias glog='g log --graph --oneline' alias gst='g status --short --branch' alias l='ls -F -h' alias la='ls -F -h -a' alias mv='mv -v' alias view='vim -R' # Suppresses line numbers in less alias less='less --line-numbers' # Defines the prompt precmd() { vcs_info # check if vcs_info_msg_0_ is empty to avoid an anoying space in the prompt if [[ -z ${vcs_info_msg_0_} ]]; then PS1='%B%F{green}%(3~|…/%2~|%~)%f %%%b ' else PS1='%B%F{green}%(3~|…/%2~|%~)%f %F{cyan}${vcs_info_msg_0_}%f %%%b ' fi } # List of non-alphanumeric characters considered part of a word export WORDCHARS='*?_-.[]~=&;!#$%^(){}<>' # Do not create a history file for less export LESSHISTFILE=/dev/null # Disable features like shell or pipe commands and more in less export LESSSECURE=1