From b90e7dd4009f92db2ea477290e69aa28bdddc678 Mon Sep 17 00:00:00 2001 From: Derek Chen-Becker Date: Sun, 15 Feb 2015 12:58:30 -0700 Subject: [PATCH] Allow the `terminal` module auto-title for tmux Allows the user to selectively enable auto window titles in tmux. Defaults to not using window titles in tmux. --- modules/terminal/init.zsh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/terminal/init.zsh b/modules/terminal/init.zsh index 01140d8c..6c9bc808 100644 --- a/modules/terminal/init.zsh +++ b/modules/terminal/init.zsh @@ -74,7 +74,12 @@ function _terminal-set-titles-with-path { local truncated_path="${abbreviated_path/(#m)?(#c15,)/...${MATCH[-12,-1]}}" unset MATCH - set-window-title "$abbreviated_path" + if zstyle -t ':prezto:module:terminal' auto-tmux-title && [[ -n "$TMUX" ]] + then + set-window-title "$truncated_path" + else + set-window-title "$abbreviated_path" + fi set-tab-title "$truncated_path" } @@ -111,7 +116,8 @@ fi # Set up non-Apple terminals. if zstyle -t ':prezto:module:terminal' auto-title \ - && ( ! [[ -n "$STY" || -n "$TMUX" ]] ) + && ( ! [[ -n "$STY" ]] ) \ + && ( ( ! [[ -n "$TMUX" ]] ) || zstyle -t ':prezto:module:terminal' auto-tmux-title ) then # Sets the tab and window titles before the prompt is displayed. add-zsh-hook precmd _terminal-set-titles-with-path @@ -119,3 +125,4 @@ then # Sets the tab and window titles before command execution. add-zsh-hook preexec _terminal-set-titles-with-command fi +