Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Ohmyzsh
Commits
ef7e53a7
Commit
ef7e53a7
authored
Feb 10, 2015
by
Robby Russell
Browse files
Merge pull request #3568 from mcornella/apjanke-title-disable-check
Repost #3426: move DISABLE_AUTO_TITLE check to hooks
parents
6aa9720b
2e41d06b
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/termsupport.zsh
View file @
ef7e53a7
#usage: title short_tab_title looooooooooooooooooooooggggggg_windows_title
# Set terminal window and tab/icon title
#http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1
#
#Fully support screen, iterm, and probably most modern xterm and rxvt
# 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
{
function
title
{
if
[[
"
$DISABLE_AUTO_TITLE
"
==
"true"
]]
||
[[
"
$EMACS
"
==
*
term
*
]]
;
then
[[
"
$EMACS
"
==
*
term
*
]]
&&
return
return
fi
# if $2 is unset use $1 as default
# if it is set and empty, leave it as is
:
${
2
=
$1
}
if
[[
"
$TERM
"
==
screen
*
]]
;
then
if
[[
"
$TERM
"
==
screen
*
]]
;
then
print
-Pn
"
\e
k
$1
:q
\e\\
"
#set screen hardstatus, usually truncated at 20 chars
print
-Pn
"
\e
k
$1
:q
\e\\
"
#set screen hardstatus, usually truncated at 20 chars
elif
[[
"
$TERM
"
==
xterm
*
]]
||
[[
$TERM
==
rxvt
*
]]
||
[[
$TERM
==
ansi
]]
||
[[
"
$TERM_PROGRAM
"
==
"iTerm.app"
]]
;
then
elif
[[
"
$TERM
"
==
xterm
*
]]
||
[[
"
$TERM
"
==
rxvt
*
]]
||
[[
"
$TERM
"
==
ansi
]]
||
[[
"
$TERM_PROGRAM
"
==
"iTerm.app"
]]
;
then
print
-Pn
"
\e
]2;
$2
:q
\a
"
#set window name
print
-Pn
"
\e
]2;
$2
:q
\a
"
#set window name
print
-Pn
"
\e
]1;
$1
:q
\a
"
#set icon (=tab) name
print
-Pn
"
\e
]1;
$1
:q
\a
"
#set icon (=tab) name
fi
fi
...
@@ -18,6 +26,10 @@ ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~"
...
@@ -18,6 +26,10 @@ ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~"
# Runs before showing the prompt
# Runs before showing the prompt
function
omz_termsupport_precmd
{
function
omz_termsupport_precmd
{
if
[[
$DISABLE_AUTO_TITLE
==
true
]]
;
then
return
fi
title
$ZSH_THEME_TERM_TAB_TITLE_IDLE
$ZSH_THEME_TERM_TITLE_IDLE
title
$ZSH_THEME_TERM_TAB_TITLE_IDLE
$ZSH_THEME_TERM_TITLE_IDLE
# Notify Terminal.app of current directory using undocumented OSC sequence
# Notify Terminal.app of current directory using undocumented OSC sequence
...
@@ -30,6 +42,10 @@ function omz_termsupport_precmd {
...
@@ -30,6 +42,10 @@ function omz_termsupport_precmd {
# Runs before executing the command
# Runs before executing the command
function
omz_termsupport_preexec
{
function
omz_termsupport_preexec
{
if
[[
$DISABLE_AUTO_TITLE
==
true
]]
;
then
return
fi
emulate
-L
zsh
emulate
-L
zsh
setopt extended_glob
setopt extended_glob
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment