From 650a1b0e21cf32a247d26c94ad8462c6c9602957 Mon Sep 17 00:00:00 2001 From: Von Random Date: Wed, 22 May 2024 10:50:56 +0300 Subject: [PATCH] zsh: shorten window title --- cli/.config/zsh/prompt.zsh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cli/.config/zsh/prompt.zsh b/cli/.config/zsh/prompt.zsh index 8149325..af4b8eb 100644 --- a/cli/.config/zsh/prompt.zsh +++ b/cli/.config/zsh/prompt.zsh @@ -35,6 +35,11 @@ prompt.set_bang() { prompt_symbols[bang]=$1 } +precmd.window_title() { + typeset dir=$(pwd) + printf '\033]0;%s:%s\007' ${HOST%%.*} ${dir##*/} +} + precmd.is_git_repo() { typeset prompt_git_dir prompt_git_dir=$(git rev-parse --git-dir 2>/dev/null) || return 1 @@ -132,10 +137,6 @@ precmd.prompt.update() { zle && zle reset-prompt } -precmd.window_title() { - printf '\033]0;%s %s\007' ${HOST%%.*} $(pwd) -} - precmd() { precmd.window_title if precmd.is_git_repo; then