Baixar o script do git-prompt e colocar na raiz ~/
Copiar e colar o trecho do meu-estilo depois da ultima linha do seu arquivo de configuração do bash (~/bashrc|~/.bash_profile)
Baixar o script do git-prompt e colocar na raiz ~/
Copiar e colar o trecho do meu-estilo depois da ultima linha do seu arquivo de configuração do bash (~/bashrc|~/.bash_profile)
| # Configuracao git-prompt | |
| # Cores | |
| MAGENTA="\[\033[0;35m\]" | |
| AMARELO="\[\033[01;33m\]" | |
| AZUL="\[\033[00;34m\]" | |
| LIGHT_GRAY="\[\033[0;37m\]" | |
| BRANCO="\[\033[0;39m\]" | |
| CYAN="\[\033[01;36m\]" | |
| VERDE="\[\033[01;32m\]" | |
| VERMELHO="\[\033[0;31m\]" | |
| export LS_OPTIONS='--color=auto' | |
| export CLICOLOR='Yes' | |
| export LSCOLORS=gxfxbEaEBxxEhEhBaDaCaD | |
| function colorir_prompt { | |
| local __usuario_e_host="$VERDE\u:" # Adicionr '\h' para exibi o nome do host | |
| local __caminho="$CYAN\w" # Exibi o caminho ('\W': atual | '\w': completo) | |
| local __git_branch_cor="$VERDE" | |
| local __prompt_tail="$BRANCO$" | |
| local __usuario_input="$BRANCO" | |
| local __git_branch='$(__git_ps1)'; | |
| # Colore o branch dependendo do estado | |
| if [[ "$(__git_ps1)" =~ "*" ]]; then # Se repositorio sujo | |
| __git_branch_cor="$VERMELHO" | |
| elif [[ "$(__git_ps1)" =~ "$" ]]; then # Se existe alguma coisa em stashed | |
| __git_branch_cor="$AMARELO" | |
| elif [[ "$(__git_ps1)" =~ "%" ]]; then # Se somente existe arquivos untracked | |
| __git_branch_cor="$LIGHT_GRAY" | |
| elif [[ "$(__git_ps1)" =~ "+" ]]; then # Se existe arquivos em staged | |
| __git_branch_cor="$CYAN" | |
| fi | |
| # Constroi a string do prompt | |
| PS1="$__usuario_e_host $__caminho$__git_branch_cor$__git_branch $__prompt_tail$__usuario_input " | |
| } | |
| # Chama PROMPT_COMMAND que e executado antes de PS1 | |
| export PROMPT_COMMAND=colorir_prompt | |
| if [ -f ~/.git-prompt.sh ]; then | |
| GIT_PS1_SHOWDIRTYSTATE=true | |
| GIT_PS1_SHOWSTASHSTATE=true | |
| GIT_PS1_SHOWUNTRACKEDFILES=true | |
| GIT_PS1_SHOWUPSTREAM="auto" | |
| GIT_PS1_HIDE_IF_PWD_IGNORED=true | |
| GIT_PS1_SHOWCOLORHINTS=true | |
| . ~/.git-prompt.sh | |
| fi |