Last active
          June 26, 2018 15:57 
        
      - 
      
- 
        Save davidmh/6228319 to your computer and use it in GitHub Desktop. 
    iTerm Tab & Window Titles with zsh and git. original: http://timbabwe.com/2012/05/iterm_tab_and_window_titles_with_zsh
  
        
  
    
      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 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