Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # set tab title to cwd
- # If the working directory is part of a git project, it sets the window title to the project top level directory path, and the tab title to the project top level directory name.
- # Otherwise uses de relative path.
- 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"
- }
Add Comment
Please, Sign In to add comment