This commit is contained in:
Johannes Findeisen 2026-11-21 13:30:17 +01:00
commit b9bd6c2dc3

21
.zshrc
View file

@ -1,6 +1,9 @@
# Source some global/public stuff. # Source some global/public stuff.
source ~/.env source ~/.env
# Disable Oh My Zsh auto-title; custom title handling is defined below.
DISABLE_AUTO_TITLE="true"
# Load Oh-my-Zsh. # Load Oh-my-Zsh.
source ~/.zsh/oh-my-zsh.sh source ~/.zsh/oh-my-zsh.sh
@ -8,18 +11,23 @@ source ~/.zsh/oh-my-zsh.sh
case $TERM in case $TERM in
linux*) linux*)
export TERM=linux export TERM=linux
precmd () {print -Pn "\e]0;%n@%m: %~\a"} _hanez_precmd_title() { print -Pn "\e]0;%n@%m: %~\a" }
;; ;;
xterm*) xterm*)
export TERM=xterm-256color export TERM=xterm-256color
precmd () {print -Pn "\e]0;%n@%m: %~\a"} _hanez_precmd_title() { print -Pn "\e]0;%n@%m: %~\a" }
;; ;;
screen*) screen*)
export TERM=screen-256color export TERM=screen-256color
precmd () {print -Pn "\e]0;%n@%m: %~\a"} _hanez_precmd_title() { print -Pn "\e]0;%n@%m: %~\a" }
;; ;;
esac esac
if (( ${+functions[_hanez_precmd_title]} )); then
autoload -Uz add-zsh-hook
add-zsh-hook precmd _hanez_precmd_title
fi
# Source some functions # Source some functions
for function in ~/.zsh/functions.d/*.sh; do for function in ~/.zsh/functions.d/*.sh; do
source $function source $function
@ -29,13 +37,16 @@ home up
# Update tmux window title to the current running command. # Update tmux window title to the current running command.
if [ -n "$TMUX" ]; then if [ -n "$TMUX" ]; then
function preexec() { autoload -Uz add-zsh-hook
function _hanez_tmux_preexec() {
local cmd=${1[(wr)^(*=*|sudo|su|command)]} local cmd=${1[(wr)^(*=*|sudo|su|command)]}
print -Pn "\e]2;${cmd%% *}\a" print -Pn "\e]2;${cmd%% *}\a"
} }
function precmd() { function _hanez_tmux_precmd() {
print -Pn "\e]2;zsh\a" print -Pn "\e]2;zsh\a"
} }
add-zsh-hook preexec _hanez_tmux_preexec
add-zsh-hook precmd _hanez_tmux_precmd
fi fi
# Source some private stuff or custom things that are different on my # Source some private stuff or custom things that are different on my