From 0b7e47b0091abb4ca4a6a1195ffa220286dadb29 Mon Sep 17 00:00:00 2001 From: Wes Morgan Date: Wed, 24 Oct 2012 09:21:35 -0600 Subject: [PATCH] set tab titles to current path on Apple Terminal --- modules/terminal/init.zsh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/terminal/init.zsh b/modules/terminal/init.zsh index dc78a3be..cef45d69 100644 --- a/modules/terminal/init.zsh +++ b/modules/terminal/init.zsh @@ -85,13 +85,14 @@ function set-titles-with-path { setopt EXTENDED_GLOB local absolute_path="${${1:a}:-$PWD}" + local abbreviated_path="${absolute_path/#$HOME/~}" + local truncated_path="${abbreviated_path/(#m)?(#c15,)/...${MATCH[-12,-1]}}" + unset MATCH if [[ "$TERM_PROGRAM" == 'Apple_Terminal' ]]; then printf '\e]7;%s\a' "file://$HOST${absolute_path// /%20}" + set-terminal-tab-title "$truncated_path" else - local abbreviated_path="${absolute_path/#$HOME/~}" - local truncated_path="${abbreviated_path/(#m)?(#c15,)/...${MATCH[-12,-1]}}" - unset MATCH if [[ "$TERM" == screen* ]]; then set-screen-window-title "$truncated_path"