mirror of
https://github.com/dcarrillo/prezto.git
synced 2024-12-22 19:48:00 +00:00
Choose title for terminal multiplexers
This commit is contained in:
parent
53bd555c6d
commit
b5bcc89ae6
@ -17,6 +17,8 @@ Auto titling is disabled inside terminal multiplexers, except inside dvtm, since
|
|||||||
it interferes with window names defined in configuration files and profile
|
it interferes with window names defined in configuration files and profile
|
||||||
managers.
|
managers.
|
||||||
|
|
||||||
|
### Title formats
|
||||||
|
|
||||||
To format terminal window and tab titles, add the following to *zpreztorc*:
|
To format terminal window and tab titles, add the following to *zpreztorc*:
|
||||||
|
|
||||||
zstyle ':prezto:module:terminal:window-title' format '%n@%m: %s'
|
zstyle ':prezto:module:terminal:window-title' format '%n@%m: %s'
|
||||||
@ -27,6 +29,11 @@ executing program name.
|
|||||||
|
|
||||||
For a list of sequences, see [Expansion of Prompt Sequences][1].
|
For a list of sequences, see [Expansion of Prompt Sequences][1].
|
||||||
|
|
||||||
|
Users of terminal multiplexers like screen can choose which title format should
|
||||||
|
be used (`window-title` or `tab-title`).
|
||||||
|
|
||||||
|
zstyle ':prezto:module:terminal' multiplexer-title 'window-title'
|
||||||
|
|
||||||
Functions
|
Functions
|
||||||
---------
|
---------
|
||||||
|
|
||||||
@ -39,6 +46,7 @@ Authors
|
|||||||
*The authors of this module should be contacted via the [issue tracker][2].*
|
*The authors of this module should be contacted via the [issue tracker][2].*
|
||||||
|
|
||||||
- [Sorin Ionescu](https://github.com/sorin-ionescu)
|
- [Sorin Ionescu](https://github.com/sorin-ionescu)
|
||||||
|
- [Olaf Conradi](https://github.com/oohlaf)
|
||||||
|
|
||||||
[1]: http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Expansion-of-Prompt-Sequences
|
[1]: http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Expansion-of-Prompt-Sequences
|
||||||
[2]: https://github.com/sorin-ionescu/prezto/issues
|
[2]: https://github.com/sorin-ionescu/prezto/issues
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#
|
#
|
||||||
# Authors:
|
# Authors:
|
||||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||||
|
# Olaf Conradi <olaf@conradi.org>
|
||||||
#
|
#
|
||||||
|
|
||||||
# Return if requirements are not found.
|
# Return if requirements are not found.
|
||||||
@ -10,13 +11,18 @@ if [[ "$TERM" == (dumb|linux|*bsd*) ]]; then
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Set default title for terminal multiplexers to the window title.
|
||||||
|
zstyle ':prezto:module:terminal' multiplexer-title 'window-title'
|
||||||
|
|
||||||
# Sets the terminal or terminal multiplexer window title.
|
# Sets the terminal or terminal multiplexer window title.
|
||||||
function set-window-title {
|
function set-window-title {
|
||||||
local title_format{,ted}
|
local title_format{,ted}
|
||||||
zstyle -s ':prezto:module:terminal:window-title' format 'title_format' || title_format="%s"
|
zstyle -s ':prezto:module:terminal:window-title' format 'title_format' || title_format="%s"
|
||||||
zformat -f title_formatted "$title_format" "s:$argv"
|
zformat -f title_formatted "$title_format" "s:$argv"
|
||||||
|
|
||||||
if [[ "$TERM" == screen* ]]; then
|
if zstyle -t ':prezto:module:terminal' multiplexer-title 'window-title' \
|
||||||
|
&& [[ "$TERM" == screen* ]]
|
||||||
|
then
|
||||||
title_format="\ek%s\e\\"
|
title_format="\ek%s\e\\"
|
||||||
else
|
else
|
||||||
title_format="\e]2;%s\a"
|
title_format="\e]2;%s\a"
|
||||||
@ -25,13 +31,21 @@ function set-window-title {
|
|||||||
printf "$title_format" "${(V%)title_formatted}"
|
printf "$title_format" "${(V%)title_formatted}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Sets the terminal tab title.
|
# Sets the terminal or terminal multiplexer tab title.
|
||||||
function set-tab-title {
|
function set-tab-title {
|
||||||
local title_format{,ted}
|
local title_format{,ted}
|
||||||
zstyle -s ':prezto:module:terminal:tab-title' format 'title_format' || title_format="%s"
|
zstyle -s ':prezto:module:terminal:tab-title' format 'title_format' || title_format="%s"
|
||||||
zformat -f title_formatted "$title_format" "s:$argv"
|
zformat -f title_formatted "$title_format" "s:$argv"
|
||||||
|
|
||||||
printf "\e]1;%s\a" ${(V%)title_formatted}
|
if zstyle -t ':prezto:module:terminal' multiplexer-title 'tab-title' \
|
||||||
|
&& [[ "$TERM" == screen* ]]
|
||||||
|
then
|
||||||
|
title_format="\ek%s\e\\"
|
||||||
|
else
|
||||||
|
title_format="\e]1;%s\a"
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "$title_format" "${(V%)title_formatted}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Sets the tab and window titles with a given command.
|
# Sets the tab and window titles with a given command.
|
||||||
|
@ -143,6 +143,9 @@ zstyle ':prezto:module:prompt' theme 'sorin'
|
|||||||
# Set the tab title format.
|
# Set the tab title format.
|
||||||
# zstyle ':prezto:module:terminal:tab-title' format '%m: %s'
|
# zstyle ':prezto:module:terminal:tab-title' format '%m: %s'
|
||||||
|
|
||||||
|
# Choose tab-title as the multiplexer title
|
||||||
|
# zstyle ':prezto:module:terminal' multiplexer-title 'tab-title'
|
||||||
|
|
||||||
#
|
#
|
||||||
# Tmux
|
# Tmux
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user