From 3b0300b86fea6f09b50538612777dd361a7b4ff9 Mon Sep 17 00:00:00 2001 From: eeemsi Date: Tue, 10 Jan 2023 18:51:12 +0100 Subject: [PATCH] new (zshrc): add current zshrc - some parts are not functional at the moment --- zshrc | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 zshrc diff --git a/zshrc b/zshrc new file mode 100644 index 0000000..7babe23 --- /dev/null +++ b/zshrc @@ -0,0 +1,80 @@ +# 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' + +# 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 + +### +# +# HOMEBREW +# +### + +eval "$(/opt/homebrew/bin/brew shellenv)"