1
0
Fork 0

set tab titles to current path on Apple Terminal

pull/316/head
Wes Morgan 12 years ago
parent 13b501adaf
commit 0b7e47b009

@ -85,13 +85,14 @@ function set-titles-with-path {
setopt EXTENDED_GLOB setopt EXTENDED_GLOB
local absolute_path="${${1:a}:-$PWD}" 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 if [[ "$TERM_PROGRAM" == 'Apple_Terminal' ]]; then
printf '\e]7;%s\a' "file://$HOST${absolute_path// /%20}" printf '\e]7;%s\a' "file://$HOST${absolute_path// /%20}"
set-terminal-tab-title "$truncated_path"
else else
local abbreviated_path="${absolute_path/#$HOME/~}"
local truncated_path="${abbreviated_path/(#m)?(#c15,)/...${MATCH[-12,-1]}}"
unset MATCH
if [[ "$TERM" == screen* ]]; then if [[ "$TERM" == screen* ]]; then
set-screen-window-title "$truncated_path" set-screen-window-title "$truncated_path"

Loading…
Cancel
Save