mirror of
https://github.com/dcarrillo/prezto.git
synced 2024-12-22 13:58: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
|
||||
managers.
|
||||
|
||||
### Title formats
|
||||
|
||||
To format terminal window and tab titles, add the following to *zpreztorc*:
|
||||
|
||||
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].
|
||||
|
||||
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
|
||||
---------
|
||||
|
||||
@ -39,6 +46,7 @@ Authors
|
||||
*The authors of this module should be contacted via the [issue tracker][2].*
|
||||
|
||||
- [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
|
||||
[2]: https://github.com/sorin-ionescu/prezto/issues
|
||||
|
@ -3,6 +3,7 @@
|
||||
#
|
||||
# Authors:
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
# Olaf Conradi <olaf@conradi.org>
|
||||
#
|
||||
|
||||
# Return if requirements are not found.
|
||||
@ -10,13 +11,18 @@ if [[ "$TERM" == (dumb|linux|*bsd*) ]]; then
|
||||
return 1
|
||||
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.
|
||||
function set-window-title {
|
||||
local title_format{,ted}
|
||||
zstyle -s ':prezto:module:terminal:window-title' format 'title_format' || title_format="%s"
|
||||
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\\"
|
||||
else
|
||||
title_format="\e]2;%s\a"
|
||||
@ -25,13 +31,21 @@ function set-window-title {
|
||||
printf "$title_format" "${(V%)title_formatted}"
|
||||
}
|
||||
|
||||
# Sets the terminal tab title.
|
||||
# Sets the terminal or terminal multiplexer tab title.
|
||||
function set-tab-title {
|
||||
local title_format{,ted}
|
||||
zstyle -s ':prezto:module:terminal:tab-title' format 'title_format' || title_format="%s"
|
||||
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.
|
||||
|
@ -143,6 +143,9 @@ zstyle ':prezto:module:prompt' theme 'sorin'
|
||||
# Set the tab title format.
|
||||
# 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
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user