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