Last active
          May 1, 2019 12:53 
        
      - 
      
- 
        Save srathbone/1e0bee57ffdb55c3616f801879b79af1 to your computer and use it in GitHub Desktop. 
    Bash theme
  
        
  
    
      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
    
  
  
    
  | # Colours - 38;2;r;g;bm - true colour (48 for bg) | |
| colour_end=$'\[\E[0m\]' | |
| colour_green=$'\[\E[0;2;38;2;112;156;52m\]' | |
| colour_bold_green=$'\[\E[0;1;38;2;112;156;52m\]' | |
| colour_blue=$'\[\E[0;2;38;2;82;148;226m\]' | |
| colour_bold_blue=$'\[\E[0;1;38;2;82;148;226m\]' | |
| colour_bold_orange=$'\[\E[0;1;38;2;210;133;57m\]' | |
| colour_bold_yellow=$'\[\E[0;1;38;2;170;143;57m\]' | |
| colour_red=$'\[\E[0;2;38;2;170;75;57m\]' | |
| colour_bold_red=$'\[\E[0;1;38;2;170;75;57m\]' | |
| colour_pink=$'\[\E[0;2;38;2;204;82;243m\]' | |
| exit_code="$?" | |
| _git_prompt() { | |
| PS1GIT="" | |
| # if [[ ! -f ".git/HEAD" ]]; then | |
| # return | |
| # fi | |
| # local branch | |
| # { read -r branch; } < .git/HEAD | |
| # if [[ -n $branch ]]; then | |
| # PS1GIT="$colour_pink ${branch#ref: refs\/heads\/}$colour_end" | |
| # fi | |
| local branch | |
| branch=$(git symbolic-ref HEAD 2>/dev/null) | |
| if [[ -n $branch ]]; then | |
| PS1GIT="$colour_pink ${branch#refs\/heads\/}$colour_end" | |
| fi | |
| } | |
| _error_prompt() { | |
| PS1ERROR="" | |
| if [[ "${exit_code}" -ne "0" ]]; then | |
| PS1ERROR="${colour_bold_red} $exit_code$colour_end" | |
| fi | |
| } | |
| _jobs_prompt() { | |
| PS1JOBS="" | |
| if [[ -n $(jobs -p) ]]; then | |
| PS1JOBS="${colour_bold_orange} \j$colour_end" | |
| fi | |
| } | |
| _prompt_command() { | |
| exit_code="$?" | |
| _git_prompt | |
| _error_prompt | |
| _jobs_prompt | |
| PS1="${colour_bold_blue}[$colour_end " | |
| PS1+="$colour_greenﲾ \u@\H$colour_end " | |
| PS1+="$colour_blue \w$colour_end " | |
| if [[ -n "${PS1GIT}" ]]; then | |
| PS1+="$PS1GIT " | |
| fi | |
| if [[ -n "${PS1JOBS}" ]]; then | |
| PS1+="$PS1JOBS " | |
| fi | |
| if [[ -n "${PS1ERROR}" ]]; then | |
| PS1+="$PS1ERROR " | |
| fi | |
| PS1+="$colour_bold_blue]$colour_end\n" | |
| if [[ "${exit_code}" -ne "0" ]]; then | |
| PS1+="$colour_bold_red\$$colour_end " | |
| else | |
| PS1+="$colour_bold_green\$$colour_end " | |
| fi | |
| history -a | |
| } | |
| PROMPT_DIRTRIM=5 | |
| PROMPT_COMMAND="_prompt_command" | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment