X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/f74f72fd2127b8546ddec334cd0b96ceecdf24b5..153355965a36f946106d15cde6fc375e87ed72c4:/zsh/lib/title.zsh diff --git a/zsh/lib/title.zsh b/zsh/lib/title.zsh new file mode 100644 index 0000000..09c5947 --- /dev/null +++ b/zsh/lib/title.zsh @@ -0,0 +1,16 @@ +function title { + local tmp + tmp=(${(f)*}) + printf "\e]0;%s\a" "${tmp[1]}" +} + +case "$TERM" in + (*xterm*|rxvt*) + function title_precmd { title "${(%):-[%n@%m] %~}" } + function title_preexec { title "$1" } + ;; +esac + +autoload -U add-zsh-hook +add-zsh-hook precmd title_precmd +add-zsh-hook preexec title_preexec