• 1.
    RED="\033[0;31m"
  • 2.
    GREEN="\033[0;32m"
  • 3.
    ORANGE="\033[1;31m"
  • 4.
    YELLOW="\033[0;33m"
  • 5.
    MAGENTA="\033[0;35m"
  • 6.
    CYAN="\033[0;36m"
  • 7.
    PURPLE="\033[1;35m"
  • 8.
     
  • 9.
    DARK="\033[1;32m"
  • 10.
    DEFAULT="\033[1;32m"
  • 11.
    MEDIUM="\033[1;33m"
  • 12.
    LIGHT="\033[1;34m"
  • 13.
    WHITE="\033[1;37m"
  • 14.
     
  • 15.
    RESET="\033[m"
  • 16.
     
  • 17.
    function git_info() {
  • 18.
    	# check if we're in a git repo
  • 19.
    	git rev-parse --is-inside-work-tree &>/dev/null || return
  • 20.
     
  • 21.
    	# quickest check for what branch we're on
  • 22.
    	local branch=$(git symbolic-ref -q HEAD | sed -e 's|^refs/heads/||')
  • 23.
     
  • 24.
    	# check if it's dirty (via github.com/sindresorhus/pure)
  • 25.
    	local dirty=$(git diff --quiet --ignore-submodules HEAD &>/dev/null; [ $? -eq 1 ] && echo -e "*")
  • 26.
     
  • 27.
    	echo -e "${RESET}on ${GREEN}$branch ${RED}$dirty"
  • 28.
    }
  • 29.
     
  • 30.
    # window title
  • 31.
    PS1='\[\033]0;\W\007\]'
  • 32.
     
  • 33.
    # prompt title
  • 34.
    PS1="$PS1\n${ORANGE}\[email protected]\h ${RESET}in ${YELLOW}\w \$(git_info) ${RESET}"
  • 35.
     
  • 36.
    # testing colors
  • 37.
    # PS1="$PS1\n\[\033[0;30m\]0;30m  \[\033[0;31m\]0;31m  \[\033[0;32m\]0;32m  \[\033[0;33m\]0;33m  \[\033[0;34m\]0;34m  \[\033[0;35m\]0;35m  \[\033[0;36m\]0;36m  \[\033[0;37m\]0;37m  \n\[\033[1;30m\]1;30m  \[\033[1;31m\]1;31m  \[\033[1;32m\]1;32m  \[\033[1;33m\]1;33m  \[\033[1;34m\]1;34m  \[\033[1;35m\]1;35m  \[\033[1;36m\]1;36m  \[\033[1;37m\]1;37m  \[$RESET\]default"
  • 38.
     
  • 39.
    # default interaction prompt
  • 40.
    PS1="$PS1\n\[$LIGHT\]\$ \[$RESET\]"
  • 41.
     
  • 42.
    # continuation interactive prompt
  • 43.
    PS2="${WHITE}→ ${RESET}"
RED="\033[0;31m" GREEN="\033[0;32m" ORANGE="\033[1;31m" YELLOW="\033[0;33m" MAGENTA="\033[0;35m" CYAN="\033[0;36m" PURPLE="\033[1;35m" DARK="\033[1;32m" DEFAULT="\033[1;32m" MEDIUM="\033[1;33m" LIGHT="\033[1;34m" WHITE="\033[1;37m" RESET="\033[m" function git_info() { # check if we're in a git repo git rev-parse --is-inside-work-tree &>/dev/null || return # quickest check for what branch we're on local branch=$(git symbolic-ref -q HEAD | sed -e 's|^refs/heads/||') # check if it's dirty (via github.com/sindresorhus/pure) local dirty=$(git diff --quiet --ignore-submodules HEAD &>/dev/null; [ $? -eq 1 ] && echo -e "*") echo -e "${RESET}on ${GREEN}$branch ${RED}$dirty" } # window title PS1='\[\033]0;\W\007\]' # prompt title PS1="$PS1\n${ORANGE}\[email protected]\h ${RESET}in ${YELLOW}\w \$(git_info) ${RESET}" # testing colors # PS1="$PS1\n\[\033[0;30m\]0;30m \[\033[0;31m\]0;31m \[\033[0;32m\]0;32m \[\033[0;33m\]0;33m \[\033[0;34m\]0;34m \[\033[0;35m\]0;35m \[\033[0;36m\]0;36m \[\033[0;37m\]0;37m \n\[\033[1;30m\]1;30m \[\033[1;31m\]1;31m \[\033[1;32m\]1;32m \[\033[1;33m\]1;33m \[\033[1;34m\]1;34m \[\033[1;35m\]1;35m \[\033[1;36m\]1;36m \[\033[1;37m\]1;37m \[$RESET\]default" # default interaction prompt PS1="$PS1\n\[$LIGHT\]\$ \[$RESET\]" # continuation interactive prompt PS2="${WHITE}→ ${RESET}"

Copy Code to Clipboard Raw

Sign-in or Create a Free Account.

Snippi uses Twitter or Facebook to register and create accounts. Registration will enable you to keep track of your snippets. We never spam your timeline or wall. Ever.

Sign-in with Facebook Sign-in with Twitter