Created
August 25, 2010 17:36
-
-
Save panquetofobia/549933 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
#!/bin/sh | |
# Instalación: Copiar y pegar en ~/.bash_profile. | |
# | |
# Cambia los colores del prompt y muestra el branch del directorio actual. | |
# | |
# Ejemplo: | |
# [ardilla:~]$ cd /usr/local/sitios/enlatele | |
# [ardilla:enlatele[v3]]$ git branch | |
# master | |
# newimporter | |
# * v3 | |
# [ardilla:enlatele[v3]]$ | |
# | |
function get_git_branch | |
{ | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[\1]/' | |
} | |
function prompt | |
{ | |
local AZUL="\[\033[0;36m\]" | |
local VERDE="\[\033[0;32m\]" | |
local BLANCO="\[\033[0;37m\]" | |
local GRIS="\[\033[1;30m\]" | |
case $TERM in | |
xterm*) | |
TITLEBAR='\[\033]0;\u@\h:\w\007\]' | |
;; | |
*) | |
TITLEBAR="" | |
;; | |
esac | |
PS1="${TITLEBAR}$GRIS[$AZUL\h:\W$VERDE\$(get_git_branch)$GRIS]$BLANCO\$ " | |
PS2='> ' | |
PS4='+ ' | |
} | |
prompt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment