Last active
August 29, 2015 13:56
-
-
Save sts10/8824914 to your computer and use it in GitHub Desktop.
My bash prompt functions (includes dirty git *)
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 this parse_git_dirty function. | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working directory clean" ]] && echo "*" | |
} | |
# Replace your parse_git_branch function with this one. | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/ (\1$(parse_git_dirty))/" | |
} | |
# This function builds your prompt. It is called below | |
function prompt { | |
# Define some local colors | |
local RED="\[\033[0;31m\]" | |
local LIGHT_RED="\[\033[1;31m\]" | |
local BLUE="/e[0;34m" | |
local CHAR="✚" | |
local CHAR_COLOR="33" | |
# ❆ ♥ ♥ ☆ - Keeping some cool ASCII Characters for reference | |
# More symbols: http://www.hongkiat.com/blog/cool-ascii-symbols-get-them-now/ | |
# Here is where we actually export the PS1 Variable which stores the text for your prompt | |
export PS1="\[\e]2;\u@\h\a[\[\e[30;1m\]\t\[\e[0m\]]$RED\$(parse_git_branch) \[\e[34;1m\]\W\[\e[0m\]\n\[\e[0;33m\]$CHAR \[\e[0m\]" | |
PS2='> ' | |
PS4='+ ' | |
} | |
# Finally call the function and our prompt is all pretty | |
prompt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment