2023-01-13 17:27:17 +01:00
|
|
|
# skip customization for non-interactive shells
|
|
|
|
if [[ ! -o interactive ]]; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2023-07-20 20:15:37 +02:00
|
|
|
# Timeout, in hundredths of seconds, when reading bound multi-character
|
|
|
|
# sequences (default is 0.4 sec.)
|
|
|
|
KEYTIMEOUT=1
|
|
|
|
|
2023-02-11 09:38:02 +01:00
|
|
|
# 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
|
2023-07-20 20:10:58 +02:00
|
|
|
|
2023-01-10 18:51:12 +01:00
|
|
|
# completion system
|
|
|
|
autoload -U compinit; compinit
|
|
|
|
|
|
|
|
# retrieve information from version control systems
|
|
|
|
autoload -Uz vcs_info
|
|
|
|
|
2023-05-06 16:03:23 +02:00
|
|
|
# Case-insensitive, partial-word and then substring completion
|
|
|
|
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
|
|
|
|
2023-01-10 18:51:12 +01:00
|
|
|
# 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'
|
|
|
|
|
2023-02-03 10:42:47 +01:00
|
|
|
# Disable beeping on errors
|
|
|
|
unsetopt BEEP
|
|
|
|
|
2023-07-20 20:10:58 +02:00
|
|
|
# Define size for HISTSIZE and SAVEHIST also define path for HISTFILE
|
|
|
|
HISTSIZE=8192
|
|
|
|
SAVEHIST=8192
|
|
|
|
|
2023-01-10 18:51:12 +01:00
|
|
|
# Make cd push the old directory onto the directory stack
|
|
|
|
setopt AUTO_PUSHD
|
|
|
|
|
2023-01-10 18:51:12 +01:00
|
|
|
# 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'
|
2023-02-11 09:53:03 +01:00
|
|
|
alias l='ls -F -h'
|
2023-05-05 22:18:02 +02:00
|
|
|
alias la='ls -F -h -A'
|
2023-02-11 09:53:03 +01:00
|
|
|
alias mv='mv -v'
|
|
|
|
alias view='vim -R'
|
2023-07-29 15:32:55 +02:00
|
|
|
alias tmux-ssh="ssh -t -o RemoteCommand='tmux attach-session -d || tmux new-session'"
|
2023-02-11 09:53:03 +01:00
|
|
|
|
|
|
|
# Comfortable git aliases
|
2023-01-10 18:51:12 +01:00
|
|
|
alias g='git'
|
|
|
|
alias gc='g commit'
|
|
|
|
alias gd='g diff'
|
|
|
|
alias glog='g log --graph --oneline'
|
|
|
|
alias gst='g status --short --branch'
|
2023-05-06 16:03:23 +02:00
|
|
|
|
2023-01-10 18:51:12 +01:00
|
|
|
# Suppresses line numbers in less
|
|
|
|
alias less='less --line-numbers'
|
|
|
|
|
2023-01-13 17:39:34 +01:00
|
|
|
# Create temporary directory and cd to it
|
|
|
|
alias cdt='builtin cd "$(mktemp -d)"'
|
|
|
|
|
2023-01-10 18:51:12 +01:00
|
|
|
# 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
|
|
|
|
}
|
|
|
|
|
2023-07-21 10:02:12 +02:00
|
|
|
# include reading files from directory
|
|
|
|
for f in "${HOME}"/.zsh/*; do
|
|
|
|
source "$f"
|
|
|
|
done
|
|
|
|
|
|
|
|
unset f
|