mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-04-10 04:26:17 +02:00
Merge branch 'screen_plugin_bugfix_feature' of github.com:scosu/oh-my-zsh
Fixed the conflict and tested for the newest version. Looks like it works correctly. Refs robbyrussell/oh-my-zsh#1491 and will try the pull request Conflicts: lib/termsupport.zsh
This commit is contained in:
commit
901d0c80ff
2 changed files with 35 additions and 10 deletions
|
|
@ -6,6 +6,14 @@
|
||||||
# Fully supports screen, iterm, and probably most modern xterm and rxvt
|
# Fully supports screen, iterm, and probably most modern xterm and rxvt
|
||||||
# (In screen, only short_tab_title is used)
|
# (In screen, only short_tab_title is used)
|
||||||
# Limited support for Apple Terminal (Terminal can't set window and tab separately)
|
# Limited support for Apple Terminal (Terminal can't set window and tab separately)
|
||||||
|
|
||||||
|
ZSH_SCREEN_PLUGIN_ACTIVE=false
|
||||||
|
for i in $plugins; do
|
||||||
|
if [[ "$i" == "screen" ]]; then
|
||||||
|
ZSH_SCREEN_PLUGIN_ACTIVE=true
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
function title {
|
function title {
|
||||||
emulate -L zsh
|
emulate -L zsh
|
||||||
setopt prompt_subst
|
setopt prompt_subst
|
||||||
|
|
@ -17,8 +25,13 @@ function title {
|
||||||
: ${2=$1}
|
: ${2=$1}
|
||||||
|
|
||||||
if [[ "$TERM" == screen* ]]; then
|
if [[ "$TERM" == screen* ]]; then
|
||||||
print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars
|
# do not set the screen hardstatus, if screen plugin is active
|
||||||
elif [[ "$TERM" == xterm* ]] || [[ "$TERM" == rxvt* ]] || [[ "$TERM" == ansi ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
|
if [[ "$ZSH_SCREEN_PLUGIN_ACTIVE" != "true" ]]; then
|
||||||
|
print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars
|
||||||
|
fi
|
||||||
|
elif [[ "$TERM_PROGRAM" == "Apple_Terminal" ]]; then
|
||||||
|
print -Pn "\e]1;$1:q\a" #set icon (=tab) name (will override window name on broken terminal)
|
||||||
|
elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ "$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
|
||||||
|
|
|
||||||
|
|
@ -31,24 +31,36 @@ if [[ "$TERM" == screen* ]]; then
|
||||||
function screen_set()
|
function screen_set()
|
||||||
{
|
{
|
||||||
# set the tab window title (%t) for screen
|
# set the tab window title (%t) for screen
|
||||||
print -nR $'\033k'$1$'\033'\\\
|
print -nR $'\033k'"$1"$'\033'\\\
|
||||||
|
|
||||||
# set hardstatus of tab window (%h) for screen
|
# set hardstatus of tab window (%h) for screen
|
||||||
print -nR $'\033]0;'$2$'\a'
|
print -nR $'\033_'"$2"$'\033'\\\
|
||||||
}
|
}
|
||||||
# called by zsh before executing a command
|
# called by zsh before executing a command
|
||||||
function preexec()
|
function preexec()
|
||||||
{
|
{
|
||||||
local -a cmd; cmd=(${(z)1}) # the command string
|
local -a cmd; cmd=(${(z)3}) # the command string
|
||||||
eval "tab_title=$TAB_TITLE_PREFIX:$TAB_TITLE_EXEC"
|
if [ "$TITLE" != "" ]
|
||||||
eval "tab_hardstatus=$TAB_HARDSTATUS_PREFIX:$TAB_HARDSTATUS_EXEC"
|
then
|
||||||
|
eval "tab_title=\"$TITLE\":$TAB_TITLE_EXEC"
|
||||||
|
eval "tab_hardstatus=\"$TITLE\":$TAB_HARDSTATUS_EXEC"
|
||||||
|
else
|
||||||
|
eval "tab_title=$TAB_TITLE_PREFIX:$TAB_TITLE_EXEC"
|
||||||
|
eval "tab_hardstatus=$TAB_HARDSTATUS_PREFIX:$TAB_HARDSTATUS_EXEC"
|
||||||
|
fi
|
||||||
screen_set $tab_title $tab_hardstatus
|
screen_set $tab_title $tab_hardstatus
|
||||||
}
|
}
|
||||||
# called by zsh before showing the prompt
|
# called by zsh before showing the prompt
|
||||||
function precmd()
|
function precmd()
|
||||||
{
|
{
|
||||||
eval "tab_title=$TAB_TITLE_PREFIX:$TAB_TITLE_PROMPT"
|
if [ "$TITLE" != "" ]
|
||||||
eval "tab_hardstatus=$TAB_HARDSTATUS_PREFIX:$TAB_HARDSTATUS_PROMPT"
|
then
|
||||||
|
eval "tab_title=\"$TITLE\":$TAB_TITLE_PROMPT"
|
||||||
|
eval "tab_hardstatus=\"$TITLE\":$TAB_HARDSTATUS_PROMPT"
|
||||||
|
else
|
||||||
|
eval "tab_title=$TAB_TITLE_PREFIX:$TAB_TITLE_PROMPT"
|
||||||
|
eval "tab_hardstatus=$TAB_HARDSTATUS_PREFIX:$TAB_HARDSTATUS_PROMPT"
|
||||||
|
fi
|
||||||
screen_set $tab_title $tab_hardstatus
|
screen_set $tab_title $tab_hardstatus
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue