Skip to content

Instantly share code, notes, and snippets.

@kijtra kijtra/.bashrc
Last active Oct 5, 2017

Embed
What would you like to do?
Bash color like Windows Git Bash
function show_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \(\1\)/'
}
function show_colored_prompt {
local WHITE="\[\e[00m\]"
local GRAY="\[\e[1;30m\]"
local LIGHTGREEN="\[\e[1;32m\]"
local GREEN="\[\e[0;32m\]"
local PURPLE="\[\e[0;35m\]"
local YELLOW="\[\e[0;33m\]"
local CYAN="\[\e[0;36m\]"
local MARK="\$"
if [[ $EUID -eq 0 ]]; then
MARK="#"
fi
PS1="\n${LIGHTGREEN}\u${GREEN}@\h ${YELLOW}\w${CYAN}\$(show_git_branch)${WHITE}\n${PURPLE}${MARK}${WHITE} "
case $TERM in
kterm|xterm|mlterm|cygwin|vt102)
PS1="\[\e]0;\u@\h: \w\]${PS1}"
;;
esac
}
show_colored_prompt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.