mirror of
https://github.com/dcarrillo/prezto.git
synced 2024-12-22 12:48:01 +00:00
[Fix #324] Add configurable terminal window and tab title formats
This commit is contained in:
parent
d19c349f3f
commit
254b7c36d9
@ -17,6 +17,16 @@ 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.
|
||||||
|
|
||||||
|
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:tab-title' format '%m: %s'
|
||||||
|
|
||||||
|
`%s` will be replaced with the current working directory path or the currently
|
||||||
|
executing program name.
|
||||||
|
|
||||||
|
For a list of sequences, see [Expansion of Prompt Sequences][1].
|
||||||
|
|
||||||
Functions
|
Functions
|
||||||
---------
|
---------
|
||||||
|
|
||||||
@ -26,9 +36,10 @@ Functions
|
|||||||
Authors
|
Authors
|
||||||
-------
|
-------
|
||||||
|
|
||||||
*The authors of this module should be contacted via the [issue tracker][1].*
|
*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)
|
||||||
|
|
||||||
[1]: https://github.com/sorin-ionescu/prezto/issues
|
[1]: http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Expansion-of-Prompt-Sequences
|
||||||
|
[2]: https://github.com/sorin-ionescu/prezto/issues
|
||||||
|
|
||||||
|
@ -12,16 +12,26 @@ fi
|
|||||||
|
|
||||||
# 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}
|
||||||
|
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 [[ "$TERM" == screen* ]]; then
|
||||||
printf "\ek%s\e\\" ${(V)argv}
|
title_format="\ek%s\e\\"
|
||||||
else
|
else
|
||||||
printf "\e]2;%s\a" ${(V)argv}
|
title_format="\e]2;%s\a"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
printf "$title_format" "${(V%)title_formatted}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Sets the terminal tab title.
|
# Sets the terminal tab title.
|
||||||
function set-tab-title {
|
function set-tab-title {
|
||||||
printf "\e]1;%s\a" ${(V)argv}
|
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}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Sets the tab and window titles with a given command.
|
# Sets the tab and window titles with a given command.
|
||||||
|
@ -130,6 +130,12 @@ zstyle ':prezto:module:prompt' theme 'sorin'
|
|||||||
# Auto set the tab and window titles.
|
# Auto set the tab and window titles.
|
||||||
# zstyle ':prezto:module:terminal' auto-title 'yes'
|
# zstyle ':prezto:module:terminal' auto-title 'yes'
|
||||||
|
|
||||||
|
# Set the window title format.
|
||||||
|
# zstyle ':prezto:module:terminal:window-title' format '%n@%m: %s'
|
||||||
|
|
||||||
|
# Set the tab title format.
|
||||||
|
# zstyle ':prezto:module:terminal:tab-title' format '%m: %s'
|
||||||
|
|
||||||
#
|
#
|
||||||
# Tmux
|
# Tmux
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user