-
-
Save brycesch/6285049 to your computer and use it in GitHub Desktop.
This file contains 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
# Set terminal window name to current git repo (and branch) or current directory | |
git-repo() { | |
git remote -v | grep '(fetch)' | grep -o "\/[a-z,A-Z,\_,\-]*\." | tail -1 | cut -c 2- | grep -o "[a-z,A-Z,\_,\-]*" | |
} | |
git-branch() { | |
git branch | grep \* | cut -c 3- | |
} | |
git-term() { | |
echo -n -e "\033]0;`git-repo`\007" | |
} | |
term-tab-name() { | |
git remote >/dev/null 2>&1 | |
if (($?)); then | |
echo -n -e "\033]0;`pwd`\007" | |
else | |
git-term | |
fi | |
} | |
precmd () {term-tab-name} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
updated to work with zsh