Skip to content

Instantly share code, notes, and snippets.

@jnx
Forked from davidmh/gist:6228319
Created September 2, 2013 06:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jnx/6409792 to your computer and use it in GitHub Desktop.
Save jnx/6409792 to your computer and use it in GitHub Desktop.
function precmd() {
if command git rev-parse --git-dir > /dev/null 2>&1; then
window_label=$(git rev-parse --show-toplevel)
tab_label=$(echo $window_label | awk -F\/ '{print "[git] " $NF}')
else
window_label=${PWD/${HOME}/\~}
tab_label=$window_label
fi
echo -ne "\e]2;${window_label}\a"
echo -ne "\e]1;${tab_label: -24}\a"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment