Skip to content

Instantly share code, notes, and snippets.

@agieche
Last active December 21, 2015 13:59

Revisions

  1. agieche revised this gist Aug 23, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion .bash_profile
    Original file line number Diff line number Diff line change
    @@ -26,4 +26,4 @@ BLINK=$(tput blink)
    REVERSE=$(tput smso)
    UNDERLINE=$(tput smul)

    PS1='\n\n\n${NORMAL}${CYAN}(`date "+%H:%M:%S"`) ${RED}\W${YELLOW}${WHITE}`__git_ps1 "::${GREEN}%s"`${WHITE}\n'
    PS1='\n\n${NORMAL}${CYAN}(`date "+%H:%M:%S"`) ${RED}\W${YELLOW}${WHITE}`__git_ps1 "::${GREEN}%s"`${WHITE}\n'
  2. agieche revised this gist Aug 23, 2013. 1 changed file with 1 addition and 16 deletions.
    17 changes: 1 addition & 16 deletions .bash_profile
    Original file line number Diff line number Diff line change
    @@ -26,19 +26,4 @@ BLINK=$(tput blink)
    REVERSE=$(tput smso)
    UNDERLINE=$(tput smul)

    # set the prompt to show current working directory and git branch name, if it exists

    # this prompt is a green username, black @ symbol, cyan host, magenta current working directory and white git branch (only shows if you're in a git branch)
    # unstaged and untracked symbols are shown, too (see above)
    # this prompt uses the short colour codes defined above
    # PS1='${GREEN}\u${BLACK}@${CYAN}\h:${MAGENTA}\w${WHITE}`__git_ps1 " (%s)"`\$ '

    # this is a cyan username, @ symbol and host, magenta current working directory and white git branch
    # it uses the shorter , but visibly more complex, codes for text colours (shorter because the colour code definitions aren't needed)
    # PS1='\[\033[0;36m\]\u@\h\[\033[01m\]:\[\033[0;35m\]\w\[\033[00m\]\[\033[1;30m\]\[\033[0;37m\]`__git_ps1 " (%s)"`\[\033[00m\]\[\033[0;37m\]\$ '

    # and here's one similar to Paul Irish's famous prompt ... not sure if this is the way he does it, but it works :)
    # \033[s = save cursor position
    # \033[u = restore cursor position

    PS1='\n\n${NORMAL}${CYAN}(`date "+%H:%M:%S"`) ${RED}\u${WHITE} in ${YELLOW}\w${YELLOW}${WHITE}`__git_ps1 " on ${GREEN}%s"`\n${WHITE}${BRIGHT} => '
    PS1='\n\n\n${NORMAL}${CYAN}(`date "+%H:%M:%S"`) ${RED}\W${YELLOW}${WHITE}`__git_ps1 "::${GREEN}%s"`${WHITE}\n'
  3. agieche renamed this gist Aug 23, 2013. 1 changed file with 1 addition and 11 deletions.
    12 changes: 1 addition & 11 deletions gistfile1.sh → .bash_profile
    Original file line number Diff line number Diff line change
    @@ -37,18 +37,8 @@ UNDERLINE=$(tput smul)
    # it uses the shorter , but visibly more complex, codes for text colours (shorter because the colour code definitions aren't needed)
    # PS1='\[\033[0;36m\]\u@\h\[\033[01m\]:\[\033[0;35m\]\w\[\033[00m\]\[\033[1;30m\]\[\033[0;37m\]`__git_ps1 " (%s)"`\[\033[00m\]\[\033[0;37m\]\$ '

    # return the prompt prefix for the second line
    function set_prefix {
    BRANCH=`__git_ps1`
    if [[ -z $BRANCH ]]; then
    echo "${NORMAL}o"
    else
    echo "${UNDERLINE}+"
    fi
    }

    # and here's one similar to Paul Irish's famous prompt ... not sure if this is the way he does it, but it works :)
    # \033[s = save cursor position
    # \033[u = restore cursor position

    PS1='\n\n${NORMAL}${CYAN}(`date "+%H:%M:%S"`) ${RED}\u${WHITE} in ${YELLOW}\w${YELLOW}${WHITE}`__git_ps1 " on ${GREEN}%s"`${GREEN}\r\n${WHITE}${BRIGHT} => '
    PS1='\n\n${NORMAL}${CYAN}(`date "+%H:%M:%S"`) ${RED}\u${WHITE} in ${YELLOW}\w${YELLOW}${WHITE}`__git_ps1 " on ${GREEN}%s"`\n${WHITE}${BRIGHT} => '
  4. agieche created this gist Aug 23, 2013.
    54 changes: 54 additions & 0 deletions gistfile1.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,54 @@
    # enable git unstaged indicators - set to a non-empty value
    GIT_PS1_SHOWDIRTYSTATE="."

    # enable showing of untracked files - set to a non-empty value
    GIT_PS1_SHOWUNTRACKEDFILES="."

    # enable stash checking - set to a non-empty value
    GIT_PS1_SHOWSTASHSTATE="."

    # enable showing of HEAD vs its upstream
    GIT_PS1_SHOWUPSTREAM="auto"

    BLACK=$(tput setaf 0)
    RED=$(tput setaf 1)
    GREEN=$(tput setaf 2)
    YELLOW=$(tput setaf 3)
    LIME_YELLOW=$(tput setaf 190)
    POWDER_BLUE=$(tput setaf 153)
    BLUE=$(tput setaf 4)
    MAGENTA=$(tput setaf 5)
    CYAN=$(tput setaf 6)
    WHITE=$(tput setaf 7)
    BRIGHT=$(tput bold)
    NORMAL=$(tput sgr0)
    BLINK=$(tput blink)
    REVERSE=$(tput smso)
    UNDERLINE=$(tput smul)

    # set the prompt to show current working directory and git branch name, if it exists

    # this prompt is a green username, black @ symbol, cyan host, magenta current working directory and white git branch (only shows if you're in a git branch)
    # unstaged and untracked symbols are shown, too (see above)
    # this prompt uses the short colour codes defined above
    # PS1='${GREEN}\u${BLACK}@${CYAN}\h:${MAGENTA}\w${WHITE}`__git_ps1 " (%s)"`\$ '

    # this is a cyan username, @ symbol and host, magenta current working directory and white git branch
    # it uses the shorter , but visibly more complex, codes for text colours (shorter because the colour code definitions aren't needed)
    # PS1='\[\033[0;36m\]\u@\h\[\033[01m\]:\[\033[0;35m\]\w\[\033[00m\]\[\033[1;30m\]\[\033[0;37m\]`__git_ps1 " (%s)"`\[\033[00m\]\[\033[0;37m\]\$ '

    # return the prompt prefix for the second line
    function set_prefix {
    BRANCH=`__git_ps1`
    if [[ -z $BRANCH ]]; then
    echo "${NORMAL}o"
    else
    echo "${UNDERLINE}+"
    fi
    }

    # and here's one similar to Paul Irish's famous prompt ... not sure if this is the way he does it, but it works :)
    # \033[s = save cursor position
    # \033[u = restore cursor position

    PS1='\n\n${NORMAL}${CYAN}(`date "+%H:%M:%S"`) ${RED}\u${WHITE} in ${YELLOW}\w${YELLOW}${WHITE}`__git_ps1 " on ${GREEN}%s"`${GREEN}\r\n${WHITE}${BRIGHT} => '