Prompt - mnishiguchi/dotfiles GitHub Wiki
- git-prompt.sh
- git-completion.bash
- https://stackoverflow.com/questions/5379986/why-doesnt-my-bash-prompt-update
GIT_PS1_SHOWDIRTYSTATE=1
# ANSI codes
BLACK="\[\e[0;30m\]"
RED="\[\e[0;31m\]"
GREEN="\[\e[0;32m\]"
BROWN="\[\e[0;33m\]"
BLUE="\[\e[0;34m\]"
PURPLE="\[\e[0;35m\]"
CYAN="\[\e[0;36m\]"
LIGHT_GRAY="\[\e[0;37m\]"
DARK_GRAY="\[\e[1;30m\]"
LIGHT_RED="\[\e[1;31m\]"
LIGHT_GREEN="\[\e[1;32m\]"
YELLOW="\[\e[1;33m\]"
LIGHT_BLUE="\[\e[1;34m\]"
LIGHT_PURPLE="\[\e[1;35m\]"
LIGHT_CYAN="\[\e[1;36m\]"
WHITE="\[\e[1;37m\]"
END_COLOR="\[\e[0m\]"
source ~/.git-prompt.sh
[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion
GIT_PS1_SHOWDIRTYSTATE=1
PS1="${YELLOW}\u${END_COLOR}@${LIGHT_BLUE}\h${END_COLOR}:${LIGHT_GREEN}\w${END_COLOR}${LIGHT_GRAY}\$(__git_ps1)\n\$ "
# PS1="${YELLOW}\u${END_COLOR}:${LIGHT_CYAN}\w${END_COLOR}${LIGHT_GRAY}\$(__git_ps1)\$ "
Prompt Statement (PS)
- Used to customize your prompt string in your terminal windows to display the information you want.
The PS1 variable
-
The primary prompt variable.
-
Controls what your command line prompt looks like.
-
Used to specify the prompt string.
-
Most distributions set PS1 to a known default value, which is suitable in most cases.
-
Can be customized to display custom information on the command line.
-
e.g., some system administrators require the user and the host system name to show up on the command line as in: student@quad32 $
-
This could prove useful if you are working in multiple roles and want to be always reminded of who you are and what machine you are on.
The special characters for PS1
\u : User name
\h : Host name
\w : Current working directory
\! : History number of this command
\d : Date
Misc
$ echo $PS1 # Before
\$
$ PS1="\u@\h \$ " # Set the PS1 variable to: `\u@\h \$`
masa@Masas-Mac $ echo $PS1 # After
\u@\h \$
# Robin
if [ -f $(brew --prefix)/etc/bash_completion ]; then
source $(brew --prefix)/etc/bash_completion
GIT_PS1_SHOWDIRTYSTATE=1
git_prompt='$(__git_ps1)'
fi
PS1="===== \d \t \w$git_prompt\n\\$ "
# Jesse
PS1='\[\e[0;37m\]\u@\h:\[\e[0m\]\[\e[1;30m\]\w\[\e[1;31m\]$(__git_ps1)\[\e[0m\] $ '