Pages - Menu

Friday, October 19, 2012

Terminal - How to color it like mac?

Hi fellas!

Here you go:

function git_branch_name() {
git branch 2>/dev/null | grep -e '^*' | sed -E 's/^\* (.+)$/(\1) /'
}

function show_colored_git_branch_in_prompt() {
PS1="\[\033[01;32m\]\u@\h:\[\033[01;34m\]\w\[\033[31m\]\$(git_branch_name)\[\033[m\]$ "
}

show_colored_git_branch_in_prompt


Just place it on your .baschrc or something else depending on your distro.

Don't thank me, thank this guy.

Adios!

No comments:

Post a Comment