Created
December 15, 2017 22:04
-
-
Save android10/233ab746859f16a3dbac64e8add46cce to your computer and use it in GitHub Desktop.
Fancy prompt with git branch support
This file contains hidden or 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
# Fancy Terminal Prompt ---------------------------------------------------------- | |
txtcyn=$'\e[0;36m' # Cyan | |
txtred=$'\e[0;31m' # Red | |
txtwht=$'\e[0;37m' # White | |
txtrst=$'\e[0m' # Text Reset | |
function parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
export PS1="\[\033[01;33m\]@\u \[\033[01;34m\]\W\[$txtcyn\]\$(parse_git_branch) \[$txtrst\]\$ " | |
# -------------------------------------------------------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also for more customization:
https://code.tutsplus.com/tutorials/how-to-customize-the-command-prompt--net-20586