Files
dotfiles/private_dot_config/zsh/dot_zshrc
2026-03-29 10:37:38 +02:00

105 lines
4.1 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# color stuff
if ([ -f $XDG_CONFIG_HOME/wallpaper/current ] && [ ! -d $XDG_CACHE_HOME/wal ]) || [ -f $HOME/.reset_color ]; then
wal --cols16 dual -n -e -s -t -p "current_theme" -i .config/wallpaper/current
[ -f $HOME/.reset_color ] && rm $HOME/.reset_color
fi
if [ -f $XDG_CACHE_HOME/wal/colors ]; then
BACKGROUND_COL=$(sed '1q;d' $XDG_CACHE_HOME/wal/colors)
COL1=$(sed '2q;d' $XDG_CACHE_HOME/wal/colors)
COL2=$(sed '15q;d' $XDG_CACHE_HOME/wal/colors)
COL3=$(sed '3q;d' $XDG_CACHE_HOME/wal/colors)
COL4=$(sed '14q;d' $XDG_CACHE_HOME/wal/colors)
COL5=$(sed '4q;d' $XDG_CACHE_HOME/wal/colors)
CURSOR_COL=$(sed '16q;d' $XDG_CACHE_HOME/wal/colors)
fi
# source global shell alias & variables files
[ -f "$XDG_CONFIG_HOME/shell/alias" ] && source "$XDG_CONFIG_HOME/shell/alias"
[ -f "$XDG_CONFIG_HOME/shell/vars" ] && source "$XDG_CONFIG_HOME/shell/vars"
# Set up the prompt
#autoload -Uz promptinit
#promptinit
#prompt adam1
setopt histignorealldups sharehistory
# Use emacs keybindings even if our EDITOR is set to vi
bindkey -e
# Use modern completion system
autoload -Uz compinit
autoload -Uz colors
compinit
colors
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _expand _complete _correct _approximate
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' menu select=2
eval "$(dircolors -b)"
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
zstyle ':completion:*' menu select=long
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' use-compctl false
zstyle ':completion:*' verbose true
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
# colored GCC warnings and errors
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# main opts
setopt append_history inc_append_history share_history
# on exit, history appends rather than overwrites; history is appended as soon as cmds executed; history shared across sessions
setopt auto_menu menu_complete # autocmp first menu match
setopt autocd # type a dir to cd
setopt auto_param_slash # when a dir is completed, add a / instead of a trailing space
setopt no_case_glob no_case_match # make cmp case insensitive
setopt globdots # include dotfiles
setopt extended_glob # match ~ # ^
setopt interactive_comments # allow comments in shell
unsetopt prompt_sp # don't autoclean blanklines
stty stop undef # disable accidental ctrl s
# history opts
HISTFILE="$XDG_CACHE_HOME/zsh_history" # move histfile to cache
HISTCONTROL=ignoreboth # consecutive duplicates & commands starting with space are not saved
HISTSIZE=1000
SAVEHIST=1000
# fzf setup
source <(fzf --zsh) # allow for fzf history widget
# set up prompt
NEWLINE=$'\n'
POWERLINE_START="\ue0d4"
POWERLINE_SEPARATOR="\ue0c6"
POWERLINE_STOP="\ue0b4"
PROMPT_ENTER="" #"\ueb70"
precmd() {
print ""
if [ -z ${BACKGROUND_COL} ]; then
print -P "%F{#2e3440}${POWERLINE_START}%K{#2e3440}%F{#e5e9f0} %y on %M %K{#3b4252}%F{#2e3440}${POWERLINE_SEPARATOR}%K{#3b4252}%F{#eceff4} %n %K{#4c566a}%F{#3b4252}${POWERLINE_SEPARATOR}%F{#eceff4} %~ %K{#eceff4}%F{#4c566a}${POWERLINE_SEPARATOR} %k%F{#eceff4}${POWERLINE_STOP}" # nord theme
else
print -P "%K{${COL1}}%F{${COL2}} %N %K{${COL3}}%F{${COL4}} %n %K{${COL5}} %~ %f%k " # custom dynamic theme
fi
}
if [ -z ${BACKGROUND_COL} ]; then
PROMPT="${PROMPT_ENTER} " # nord theme
else
PROMPT="${PROMPT_ENTER} " # custom dynamic theme
fi
echo -e "${NEWLINE}\x1b[38;5;137m\x1b[48;5;0m it's $(print -P '%D{%_H:%M%P}\n') \x1b[38;5;180m\x1b[48;5;0m $(uptime -p | cut -c 4-) \x1b[38;5;223m\x1b[48;5;0m $(uname -r) \033[0m" # current
# syntax highlighting
# requires zsh-syntax-highlighting package
#source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh