Created
December 26, 2017 21:25
-
-
Save themightychris/02d8b7485acf459cbcc3d0b3dba87a42 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
BLACK="\033[01;30m" | |
MAGENTA="\033[1;31m" | |
ORANGE="\033[1;33m" | |
GREEN="\033[1;32m" | |
PURPLE="\033[1;35m" | |
WHITE="\033[1;37m" | |
BOLD="" | |
RESET="\033[m" | |
PROMPT_HOSTNAME="$(hostname)" | |
PROMPT_SYMBOL="⚡ " | |
PROMPT_SITE="\[${BOLD}${MAGENTA}\]$PROMPT_HOSTNAME" | |
PROMPT_GIT_WORKTREE="\$(git rev-parse --show-toplevel 2>/dev/null)" | |
PROMPT_GIT_RELATIVE="\$(realpath --relative-to=\"$PROMPT_GIT_WORKTREE\" .)" | |
PROMPT_LAYER="\[${BOLD}${ORANGE}\]\$(basename \"$PROMPT_GIT_WORKTREE\")" | |
PROMPT_BRANCH="\[$PURPLE\]\$(git symbolic-ref --short -q HEAD 2> /dev/null)\[$GREEN\]\$([[ -n \$(git status --porcelain 2> /dev/null) ]] && echo \"**\")" | |
PROMPT_GIT="$PROMPT_LAYER#$PROMPT_BRANCH\[$WHITE\] on $PROMPT_SITE\[$WHITE\]:\[$GREEN\]$PROMPT_GIT_RELATIVE" | |
PROMPT_REG="$PROMPT_SITE\[$WHITE\]:\[$GREEN\]\w" | |
export PS1="\$([[ -n \"$PROMPT_GIT_WORKTREE\" ]] && echo \"$PROMPT_GIT\" || echo \"$PROMPT_REG\")\[$WHITE\]\n$PROMPT_SYMBOL\[$RESET\]" | |
export PS2="\[$ORANGE\]→ \[$RESET\]" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Installation
Save to home directory:
wget -O ~/.bash_prompt https://gist.githubusercontent.com/themightychris/02d8b7485acf459cbcc3d0b3dba87a42/raw/16a53ae4eccffe3de9587f922e800dfd676e10c4/.bash_prompt
Try it out:
Make it permanent: