From 02f7bfe7f2ba490007606f6787ce01731b83ff62 Mon Sep 17 00:00:00 2001 From: Caleb Epstein Date: Fri, 16 Nov 2012 15:08:39 -0500 Subject: [PATCH] Added user-controllable prefix for window and tab titles. These new styles that may be used to add a prefix to the window and tab title strings. These undergo prompt expansion. zstyle ':prezto:module:terminal' prefix '%n @ %m: ' zstyle ':prezto:module:terminal' tabprefix '%m: ' --- modules/terminal/README.md | 7 +++++++ modules/terminal/init.zsh | 8 ++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/modules/terminal/README.md b/modules/terminal/README.md index f1256c69..339ae1f5 100644 --- a/modules/terminal/README.md +++ b/modules/terminal/README.md @@ -13,6 +13,13 @@ directory, add the following to *zpreztorc*: zstyle ':prezto:module:terminal' auto-title 'yes' +A user-defined prefix may be added to the title using the following +styles, which undergo prompt expansion: + + zstyle ':prezto:module:terminal' prefix '%n @ %m: ' + zstyle ':prezto:module:terminal' tabprefix '%n @ %m: ' + + Functions --------- diff --git a/modules/terminal/init.zsh b/modules/terminal/init.zsh index dc78a3be..a297fd1a 100644 --- a/modules/terminal/init.zsh +++ b/modules/terminal/init.zsh @@ -28,14 +28,18 @@ function set-screen-window-title { # Sets the terminal window title. function set-terminal-window-title { if [[ "$TERM" == ((x|a|ml|dt|E)term*|(u|)rxvt*) ]]; then - printf "\e]2;%s\a" ${(V)argv} + local prefix + zstyle -s ':prezto:module:terminal' prefix 'prefix' + printf "\e]2;%s%s\a" ${(V%)prefix} ${(V)argv} fi } # Sets the terminal tab title. function set-terminal-tab-title { if [[ "$TERM" == ((x|a|ml|dt|E)term*|(u|)rxvt*) ]]; then - printf "\e]1;%s\a" ${(V)argv} + local prefix + zstyle -s ':prezto:module:terminal' prefix 'tabprefix' + printf "\e]1;%s%s\a" ${(V%)prefix} ${(V)argv} fi }