set window title

This commit is contained in:
Ray Elliott 2020-04-01 17:39:01 +01:00
parent d68538968a
commit f9980f5eb6
1 changed files with 18 additions and 10 deletions

28
zshrc
View File

@ -1,3 +1,6 @@
# if using zgen must do 'zgen reset' after any changes to this file
emulate sh emulate sh
source "${HOME}/.profile" source "${HOME}/.profile"
emulate zsh emulate zsh
@ -11,6 +14,21 @@ else
compinit -C -i compinit -C -i
fi fi
# https://wiki.archlinux.org/index.php/Zsh#xterm_title
autoload -Uz add-zsh-hook
function xterm_title_precmd () {
print -Pn -- '\e]2;%n@%m %~\a'
[[ "$TERM" == 'screen'* ]] && print -Pn -- '\e_\005{g}%n\005{-}@\005{m}%m\005{-} \005{B}%~\005{-}\e\\'
}
function xterm_title_preexec () {
print -Pn -- '\e]2;%n@%m %~ %# ' && print -n -- "${(q)1}\a"
[[ "$TERM" == 'screen'* ]] && { print -Pn -- '\e_\005{g}%n\005{-}@\005{m}%m\005{-} \005{B}%~\005{-} %# ' && print -n -- "${(q)1}\e\\"; }
}
if [[ "$TERM" == (alacritty*|gnome*|konsole*|putty*|rxvt*|screen*|tmux*|xterm*) ]]; then
add-zsh-hook -Uz precmd xterm_title_precmd
add-zsh-hook -Uz preexec xterm_title_preexec
fi
# zgen # zgen
# https://github.com/tarjoilija/zgen # https://github.com/tarjoilija/zgen
@ -68,13 +86,6 @@ zstyle ':completion:::::' completer _expand _complete _ignored _approximate # en
bindkey -v bindkey -v
# export PATH=~/.npm-global/bin:$PATH
# export PATH=$(ruby -r rubygems -e "puts Gem.user_dir")/bin:$PATH
# export PATH=/home/ray/.bin:$PATH
# The following line was added by compinstall # The following line was added by compinstall
zstyle :compinstall filename '/home/ray/.zshrc' zstyle :compinstall filename '/home/ray/.zshrc'
zmodload -i zsh/complist zmodload -i zsh/complist
@ -97,9 +108,6 @@ bindkey '' history-substring-search-up
bindkey '' history-substring-search-down bindkey '' history-substring-search-down
# auto-ls settings
# AUTO_LS_COMMANDS=(ls)
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=239' ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=239'
#zsh-autosuggestion settings #zsh-autosuggestion settings