This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function iterm_tab_and_window_titles_precmd() { | |
if command git rev-parse --git-dir > /dev/null 2>&1; then | |
local window_label=$(git rev-parse --show-toplevel) | |
local tab_label=$(echo $window_label | awk -F\/ '{print "[git] " $NF}') | |
else | |
local window_label=${PWD/${HOME}/\~} | |
local tab_label=$window_label | |
fi | |
echo -ne "\e]2;${window_label}\a" | |
echo -ne "\e]1;${tab_label: -24}\a" |