Guest User

Untitled

a guest
Oct 18th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. # set tab title to cwd
  2. # 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.
  3. # Otherwise uses de relative path.
  4. function precmd() {
  5. if command git rev-parse --git-dir > /dev/null 2>&1; then
  6. window_label=$(git rev-parse --show-toplevel)
  7. tab_label=$(echo $window_label | awk -F\/ '{print "[git] " $NF}')
  8. else
  9. window_label=${PWD/${HOME}/\~}
  10. tab_label=$window_label
  11. fi
  12. echo -ne "\e]2;${window_label}\a"
  13. echo -ne "\e]1;${tab_label: -24}\a"
  14. }
Add Comment
Please, Sign In to add comment