forked from extern/ohmyzsh
term: Move DISABLE_AUTO_TITLE check to hooks
Move the DISABLE_AUTO_TITLE check from title() to the preX hook functions that call it, to allow the title() function to be used directly by user or other callers.
This commit is contained in:
parent
13e5afe805
commit
4fc6dccb42
@ -1,8 +1,16 @@
|
||||
#usage: title short_tab_title looooooooooooooooooooooggggggg_windows_title
|
||||
#http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1
|
||||
#Fully support screen, iterm, and probably most modern xterm and rxvt
|
||||
# Set terminal window and tab/icon title
|
||||
#
|
||||
# usage: title short_tab_title [long_window_title]
|
||||
#
|
||||
# See: http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1
|
||||
# Fully supports screen, iterm, and probably most modern xterm and rxvt
|
||||
# (In screen, only short_tab_title is used)
|
||||
# Limited support for Apple Terminal (Terminal can't set window and tab separately)
|
||||
function title {
|
||||
if [[ "$DISABLE_AUTO_TITLE" == "true" ]] || [[ "$EMACS" == *term* ]]; then
|
||||
if [[ $2 == "" ]]; then
|
||||
2="$1"
|
||||
fi
|
||||
if [[ "$EMACS" == *term* ]]; then
|
||||
return
|
||||
fi
|
||||
if [[ "$TERM" == screen* ]]; then
|
||||
@ -18,6 +26,10 @@ ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~"
|
||||
|
||||
# Runs before showing the prompt
|
||||
function omz_termsupport_precmd {
|
||||
if [[ $DISABLE_AUTO_TITLE == true ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE
|
||||
|
||||
# Notify Terminal.app of current directory using undocumented OSC sequence
|
||||
@ -30,6 +42,10 @@ function omz_termsupport_precmd {
|
||||
|
||||
# Runs before executing the command
|
||||
function omz_termsupport_preexec {
|
||||
if [[ $DISABLE_AUTO_TITLE == true ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
emulate -L zsh
|
||||
setopt extended_glob
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user