Last active
August 7, 2017 12:31
-
-
Save tangar76/5d79aab17f114da4df38f78805d8b737 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
# add git branch name and mark if it has unstaged changes | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
evil_git_dirty() { | |
git_status="$(git status 2> /dev/null)" | |
untracked_pattern="Untracked files:" | |
not_staged_pattern="Changes not staged for commit" | |
branch_ahead="Your branch is ahead of" | |
#files not staged for commit | |
if [[ ${git_status}} =~ ${not_staged_pattern} ]]; then | |
printf " 🛠 " | |
fi | |
#untracked files | |
if [[ ${git_status} =~ ${untracked_pattern} ]]; then | |
printf " 💡 " | |
fi | |
#branch ahead | |
if [[ ${git_status}} =~ ${branch_ahead} ]]; then | |
printf " ⇡ " | |
fi | |
} | |
if [ "$color_prompt" = yes ]; then | |
# vitaliy changes | |
# PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' | |
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[33m\]$(parse_git_branch)\[\033[1;31m\]$(evil_git_dirty)\[\033[00m\]\n$ ' | |
else | |
# vitaliy changes | |
#PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' | |
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\[\033[33m\]$(parse_git_branch)\[\033[00m\]\n$ ' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment