summaryrefslogtreecommitdiff
path: root/zsh/title.zsh
diff options
context:
space:
mode:
author2025-05-04 18:13:09 +0300
committer2025-05-04 18:13:09 +0300
commitb3f074faff1f4f18b68b0b913d80e7fb6fe3433d (patch)
treecb1c1736fe58f338307ce06fbb2fefe9cdb48202 /zsh/title.zsh
parentПоправил кучку недостатков в neovim (diff)
downloaddotfiles-b3f074faff1f4f18b68b0b913d80e7fb6fe3433d.tar.gz
dotfiles-b3f074faff1f4f18b68b0b913d80e7fb6fe3433d.tar.bz2
dotfiles-b3f074faff1f4f18b68b0b913d80e7fb6fe3433d.tar.xz
dotfiles-b3f074faff1f4f18b68b0b913d80e7fb6fe3433d.zip
Почистил и ускорил zsh
Diffstat (limited to '')
-rw-r--r--zsh/title.zsh30
1 files changed, 30 insertions, 0 deletions
diff --git a/zsh/title.zsh b/zsh/title.zsh
new file mode 100644
index 0000000..911d53a
--- /dev/null
+++ b/zsh/title.zsh
@@ -0,0 +1,30 @@
+function title {
+ emulate -L zsh
+ setopt prompt_subst
+
+ [[ "$EMACS" == *term* ]] && return
+
+ # if $2 is unset use $1 as default
+ # if it is set and empty, leave it as is
+ : ${2=$1}
+
+ case "$TERM" in
+ xterm*|putty*|rxvt*|konsole*|ansi|mlterm*|alacritty|kitty|wezterm|st*)
+ print -Pn "\e]2;${2:q}\a" # set window name
+ print -Pn "\e]1;${1:q}\a" # set tab name
+ ;;
+ screen*|tmux*)
+ print -Pn "\ek${1:q}\e\\" # set screen hardstatus
+ ;;
+ *)
+ # Try to use terminfo to set the title
+ # If the feature is available set title
+ if [[ -n "$terminfo[fsl]" ]] && [[ -n "$terminfo[tsl]" ]]; then
+ echoti tsl
+ print -Pn "$1"
+ echoti fsl
+ fi
+ ;;
+ esac
+}
+