summaryrefslogtreecommitdiff
path: root/lib/termsupport.zsh
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2021-12-18 17:46:06 -0600
committerTuowen Zhao <ztuowen@gmail.com>2021-12-18 17:46:06 -0600
commit1bc186dabe12b3d01b2257e82f3a104c48b8b3c7 (patch)
tree54576312318c406b6ce2a35423198fcc92c8bf71 /lib/termsupport.zsh
parent2a977876c6e85847652f097cc128e4ed5bec147a (diff)
parent904f8685f75ff5dd3f544f8c6f2cabb8e5952e9a (diff)
downloadzsh-1bc186dabe12b3d01b2257e82f3a104c48b8b3c7.tar.gz
zsh-1bc186dabe12b3d01b2257e82f3a104c48b8b3c7.tar.bz2
zsh-1bc186dabe12b3d01b2257e82f3a104c48b8b3c7.zip
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'lib/termsupport.zsh')
-rw-r--r--lib/termsupport.zsh15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh
index ef0d78895..4035d10a1 100644
--- a/lib/termsupport.zsh
+++ b/lib/termsupport.zsh
@@ -7,11 +7,10 @@
# (In screen, only short_tab_title is used)
# Limited support for Apple Terminal (Terminal can't set window and tab separately)
function title {
- emulate -L zsh
- setopt prompt_subst
+ setopt localoptions nopromptsubst
# Don't set the title if inside emacs, unless using vterm
- [[ -n "$INSIDE_EMACS" && "$INSIDE_EMACS" != vterm ]] && return
+ [[ -n "${INSIDE_EMACS:-}" && "$INSIDE_EMACS" != vterm ]] && return
# if $2 is unset use $1 as default
# if it is set and empty, leave it as is
@@ -48,13 +47,13 @@ fi
# Runs before showing the prompt
function omz_termsupport_precmd {
- [[ "${DISABLE_AUTO_TITLE:-}" == true ]] && return
- title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE
+ [[ "${DISABLE_AUTO_TITLE:-}" != true ]] || return
+ title "$ZSH_THEME_TERM_TAB_TITLE_IDLE" "$ZSH_THEME_TERM_TITLE_IDLE"
}
# Runs before executing the command
function omz_termsupport_preexec {
- [[ "${DISABLE_AUTO_TITLE:-}" == true ]] && return
+ [[ "${DISABLE_AUTO_TITLE:-}" != true ]] || return
emulate -L zsh
setopt extended_glob
@@ -97,10 +96,10 @@ function omz_termsupport_preexec {
fi
# cmd name only, or if this is sudo or ssh, the next cmd
- local CMD=${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%}
+ local CMD="${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%}"
local LINE="${2:gs/%/%%}"
- title '$CMD' '%100>...>$LINE%<<'
+ title "$CMD" "%100>...>${LINE}%<<"
}
autoload -Uz add-zsh-hook