diff --git a/plugins/git/git-prompt-old.plugin.zsh b/plugins/git/git-prompt-old.plugin.zsh deleted file mode 100644 index ece86e6d..00000000 --- a/plugins/git/git-prompt-old.plugin.zsh +++ /dev/null @@ -1,79 +0,0 @@ -# Renders the name of the current branch. -function git_prompt_info() { - local branch=$(git_current_branch) - if [[ -n "$branch" ]]; then - echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${branch}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}" - fi -} - -# Gets the current branch. -function git_current_branch() { - local ref=$(git symbolic-ref HEAD 2> /dev/null) - if [[ -n "$ref" ]]; then - echo "${ref#refs/heads/}" - fi -} - -# Checks if the working tree is dirty. -function parse_git_dirty() { - if [[ -n $(git status -s 2> /dev/null) ]]; then - echo "$ZSH_THEME_GIT_PROMPT_DIRTY" - else - echo "$ZSH_THEME_GIT_PROMPT_CLEAN" - fi -} - -# Checks if there are commits ahead from remote. -function git_prompt_ahead() { - if $(echo "$(git log origin/$(git_current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then - echo "$ZSH_THEME_GIT_PROMPT_AHEAD" - fi -} - -# Formats the prompt string for current git commit short SHA. -function git_prompt_short_sha() { - local sha=$(git rev-parse --short HEAD 2> /dev/null) - if [[ -n "$sha" ]]; then - echo "${ZSH_THEME_GIT_PROMPT_SHA_BEFORE}${sha}${ZSH_THEME_GIT_PROMPT_SHA_AFTER}" - fi -} - -# Formats the prompt string for current git commit long SHA. -function git_prompt_long_sha() { - local sha=$(git rev-parse HEAD 2> /dev/null) - if [[ -n "$sha" ]]; then - echo "${ZSH_THEME_GIT_PROMPT_SHA_BEFORE}${sha}${ZSH_THEME_GIT_PROMPT_SHA_AFTER}" - fi -} - -# Gets the status of the working tree. -function git_prompt_status() { - local indicators line untracked added modified renamed deleted - while IFS=$'\n' read line; do - if [[ "$line" =~ '^\?\? ' ]]; then - [[ -n $untracked ]] && continue || untracked='yes' - indicators="${ZSH_THEME_GIT_PROMPT_UNTRACKED}${indicators}" - fi - if [[ "$line" =~ '^(((A|M|D|T) )|(AD|AM|AT|MM)) ' ]]; then - [[ -n $added ]] && continue || added='yes' - indicators="${ZSH_THEME_GIT_PROMPT_ADDED}${indicators}" - fi - if [[ "$line" =~ '^(( (M|T))|(AM|AT|MM)) ' ]]; then - [[ -n $modified ]] && continue || modified='yes' - indicators="${ZSH_THEME_GIT_PROMPT_MODIFIED}${indicators}" - fi - if [[ "$line" =~ '^R ' ]]; then - [[ -n $renamed ]] && continue || renamed='yes' - indicators="${ZSH_THEME_GIT_PROMPT_RENAMED}${indicators}" - fi - if [[ "$line" =~ '^( D|AD) ' ]]; then - [[ -n $deleted ]] && continue || deleted='yes' - indicators="${ZSH_THEME_GIT_PROMPT_DELETED}${indicators}" - fi - if [[ "$line" =~ '^UU ' ]]; then - [[ -n $unmerged ]] && continue || unmerged='yes' - indicators="${ZSH_THEME_GIT_PROMPT_UNMERGED}${indicators}" - fi - done < <(git status --porcelain 2> /dev/null) - echo $indicators -} diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index bb515c73..8bfe492b 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -1,3 +1,2 @@ source $ZSH/plugins/git/git-aliases.plugin.zsh -source $ZSH/plugins/git/git-prompt-old.plugin.zsh source $ZSH/plugins/git/git-prompt.plugin.zsh diff --git a/themes/Soliah.zsh-theme b/themes/Soliah.zsh-theme index e0932c4b..2f3fbbde 100644 --- a/themes/Soliah.zsh-theme +++ b/themes/Soliah.zsh-theme @@ -1,14 +1,30 @@ -PROMPT='%{$fg[blue]%}%n%{$reset_color%} on %{$fg[red]%}%M%{$reset_color%} in %{$fg[blue]%}%~%b%{$reset_color%}$(git_time_since_commit)$(check_git_prompt_info) +local R="%{$terminfo[sgr0]%}" + +PROMPT='%{$fg[blue]%}%n$R on %{$fg[red]%}%M$R in %{$fg[blue]%}%~%b$R$GIT_PROMPT_INFO $ ' -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%})" +git_prompt_info () +{ + if [ -z "$(git_prompt__git_dir)" ]; then + GIT_PROMPT_INFO="($(rvm_gemset)$R)" + return + fi + + local prompt='' + + git_prompt__branch + prompt="%{$fg[white]%}$GIT_PROMPT_BRANCH" -# Text to display if the branch is dirty -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}" + git_prompt__rebase_info + prompt="${prompt}$GIT_PROMPT_REBASE_INFO" -# Text to display if the branch is clean -ZSH_THEME_GIT_PROMPT_CLEAN="" + git_prompt__dirty_state + if [[ "$GIT_PROMPT_DIRTY_STATE_ANY_DIRTY" = 'yes' ]]; then + prompt="${prompt}%{$fg[red]%}*" + fi + + GIT_PROMPT_INFO="($(rvm_gemset)$(git_time_since_commit)$prompt$R)" +} # Colors vary depending on time lapsed. ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}" @@ -17,24 +33,11 @@ ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}" ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}" -# Git sometimes goes into a detached head state. git_prompt_info doesn't -# return anything in this case. So wrap it in another function and check -# for an empty string. -function check_git_prompt_info() { - if git rev-parse --git-dir > /dev/null 2>&1; then - if [[ -z $(git_prompt_info) ]]; then - echo "%{$fg[magenta]%}detached-head%{$reset_color%})" - else - echo "$(git_prompt_info)" - fi - fi -} - # Determine if we are using a gemset. function rvm_gemset() { GEMSET=`rvm gemset list | grep '=>' | cut -b4-` if [[ -n $GEMSET ]]; then - echo "%{$fg[yellow]%}$GEMSET%{$reset_color%}|" + echo "%{$fg[yellow]%}${GEMSET}$R|" fi } @@ -72,15 +75,15 @@ function git_time_since_commit() { fi if [ "$HOURS" -gt 24 ]; then - echo "($(rvm_gemset)$COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}|" + echo "$COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m$R|" elif [ "$MINUTES" -gt 60 ]; then - echo "($(rvm_gemset)$COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}|" + echo "$COLOR${HOURS}h${SUB_MINUTES}m$R|" else - echo "($(rvm_gemset)$COLOR${MINUTES}m%{$reset_color%}|" + echo "$COLOR${MINUTES}m$R|" fi else COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" - echo "($(rvm_gemset)$COLOR~|" + echo "$COLOR~|" fi fi } diff --git a/themes/afowler.zsh-theme b/themes/afowler.zsh-theme index 3a4753fc..136286d7 100644 --- a/themes/afowler.zsh-theme +++ b/themes/afowler.zsh-theme @@ -2,7 +2,7 @@ if [ $UID -eq 0 ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" -PROMPT='%m %{${fg_bold[blue]}%}:: %{$reset_color%}%{${fg[green]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}»%{${reset_color}%} ' +PROMPT='%m %{${fg_bold[blue]}%}:: %{$reset_color%}%{${fg[green]}%}%3~ $GIT_PROMPT_INFO%{${fg_bold[$CARETCOLOR]}%}»%{${reset_color}%} ' RPS1="${return_code}" diff --git a/themes/arrow.zsh-theme b/themes/arrow.zsh-theme index d62dcdcb..a2ef03a8 100644 --- a/themes/arrow.zsh-theme +++ b/themes/arrow.zsh-theme @@ -1,7 +1,7 @@ if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="yellow"; fi PROMPT='%{$fg[$NCOLOR]%}%c ➤ %{$reset_color%}' -RPROMPT='%{$fg[$NCOLOR]%}%p $(git_prompt_info)%{$reset_color%}' +RPROMPT='%{$fg[$NCOLOR]%}%p $GIT_PROMPT_INFO%{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX="git:" ZSH_THEME_GIT_PROMPT_SUFFIX="" diff --git a/themes/aussiegeek.zsh-theme b/themes/aussiegeek.zsh-theme index c2c7f65b..2bed46d7 100644 --- a/themes/aussiegeek.zsh-theme +++ b/themes/aussiegeek.zsh-theme @@ -1,5 +1,5 @@ -PROMPT='$fg_bold[blue][ $fg[red]%t $fg_bold[blue]] $fg_bold[blue] [ $fg[red]%n@%m:%~$(git_prompt_info)$fg[yellow]$(rvm_prompt_info)$fg_bold[blue] ]$reset_color +PROMPT='$fg_bold[blue][ $fg[red]%t $fg_bold[blue]] $fg_bold[blue] [ $fg[red]%n@%m:%~$GIT_PROMPT_INFO$fg[yellow]$(rvm_prompt_info)$fg_bold[blue] ]$reset_color $ ' # git theming ZSH_THEME_GIT_PROMPT_PREFIX="$fg_bold[green](" diff --git a/themes/awesomepanda.zsh-theme b/themes/awesomepanda.zsh-theme index 1915bd13..3e29ef55 100644 --- a/themes/awesomepanda.zsh-theme +++ b/themes/awesomepanda.zsh-theme @@ -1,6 +1,6 @@ # the svn plugin has to be activated for this to work. -PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}$(svn_prompt_info)%{$reset_color%}' +PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$GIT_PROMPT_INFO%{$fg_bold[blue]%}$(svn_prompt_info)%{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" diff --git a/themes/bira.zsh-theme b/themes/bira.zsh-theme index 5642eaeb..437c8c15 100644 --- a/themes/bira.zsh-theme +++ b/themes/bira.zsh-theme @@ -4,7 +4,7 @@ local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}' local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}' local rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}' -local git_branch='$(git_prompt_info)%{$reset_color%}' +local git_branch='$GIT_PROMPT_INFO%{$reset_color%}' PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch} ╰─%B$%b " diff --git a/themes/candy.zsh-theme b/themes/candy.zsh-theme index bc125c5c..28fb2c1e 100644 --- a/themes/candy.zsh-theme +++ b/themes/candy.zsh-theme @@ -1,4 +1,4 @@ -PROMPT=$'%{$fg_bold[green]%}%n@%m %{$fg[blue]%}%D{[%I:%M:%S]} %{$reset_color%}%{$fg[white]%}[%~]%{$reset_color%} $(git_prompt_info)\ +PROMPT=$'%{$fg_bold[green]%}%n@%m %{$fg[blue]%}%D{[%I:%M:%S]} %{$reset_color%}%{$fg[white]%}[%~]%{$reset_color%} $GIT_PROMPT_INFO\ %{$fg[blue]%}->%{$fg_bold[blue]%} %#%{$reset_color%} ' ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[" diff --git a/themes/clean.zsh-theme b/themes/clean.zsh-theme index 7ee29cb8..7ae26bcf 100644 --- a/themes/clean.zsh-theme +++ b/themes/clean.zsh-theme @@ -1,6 +1,6 @@ if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="white"; fi -PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) ' +PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $GIT_PROMPT_INFO%(!.#.$) ' RPROMPT='[%*]' # git theming diff --git a/themes/cloud.zsh-theme b/themes/cloud.zsh-theme index 4e94f61a..e4fbbfc6 100644 --- a/themes/cloud.zsh-theme +++ b/themes/cloud.zsh-theme @@ -1,4 +1,4 @@ -PROMPT='%{$fg_bold[cyan]%}☁ %{$fg_bold[green]%}%p %{$fg[green]%}%c %{$fg_bold[cyan]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' +PROMPT='%{$fg_bold[cyan]%}☁ %{$fg_bold[green]%}%p %{$fg[green]%}%c %{$fg_bold[cyan]%}$GIT_PROMPT_INFO%{$fg_bold[blue]%} % %{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[%{$fg[cyan]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" diff --git a/themes/dallas.zsh-theme b/themes/dallas.zsh-theme index eef32e99..c62b9276 100644 --- a/themes/dallas.zsh-theme +++ b/themes/dallas.zsh-theme @@ -8,7 +8,7 @@ DALLAS_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[magenta]%}\$(~/.rvm/bin/rvm-prompt i DALLAS_CURRENT_MACH_="%{$fg[green]%}%m%{$fg[white]%}:%{$reset_color%}" # Grab the current filepath, use shortcuts: ~/Desktop # Append the current git branch, if in a git repository: ~aw@master -DALLAS_CURRENT_LOCA_="%{$fg[cyan]%}%~\$(git_prompt_info)%{$reset_color%}" +DALLAS_CURRENT_LOCA_="%{$fg[cyan]%}%~\$GIT_PROMPT_INFO%{$reset_color%}" # Grab the current username: dallas DALLAS_CURRENT_USER_="%{$fg[red]%}%n%{$reset_color%}" # Use a % for normal users and a # for privelaged (root) users. diff --git a/themes/darkblood.zsh-theme b/themes/darkblood.zsh-theme index 33508fbd..7c7d2485 100644 --- a/themes/darkblood.zsh-theme +++ b/themes/darkblood.zsh-theme @@ -1,6 +1,6 @@ # meh. Dark Blood Rewind, a new beginning. -PROMPT=$'%{$fg[red]%}┌[%{$fg_bold[white]%}%n%{$reset_color%}%{$fg[red]%}@%{$fg_bold[white]%}%m%{$reset_color%}%{$fg[red]%}] [%{$fg_bold[white]%}/dev/%y%{$reset_color%}%{$fg[red]%}] %{$(git_prompt_info)%}%(?,,%{$fg[red]%}[%{$fg_bold[white]%}%?%{$reset_color%}%{$fg[red]%}]) +PROMPT=$'%{$fg[red]%}┌[%{$fg_bold[white]%}%n%{$reset_color%}%{$fg[red]%}@%{$fg_bold[white]%}%m%{$reset_color%}%{$fg[red]%}] [%{$fg_bold[white]%}/dev/%y%{$reset_color%}%{$fg[red]%}] %{$GIT_PROMPT_INFO%}%(?,,%{$fg[red]%}[%{$fg_bold[white]%}%?%{$reset_color%}%{$fg[red]%}]) %{$fg[red]%}└[%{$fg_bold[white]%}%~%{$reset_color%}%{$fg[red]%}]>%{$reset_color%} ' PS2=$' %{$fg[red]%}|>%{$reset_color%} ' diff --git a/themes/daveverwer.zsh-theme b/themes/daveverwer.zsh-theme index 89aef926..d2cd2b46 100644 --- a/themes/daveverwer.zsh-theme +++ b/themes/daveverwer.zsh-theme @@ -1,7 +1,7 @@ # Copied and modified from the oh-my-zsh theme from geoffgarside # Red server name, green cwd, blue git status -PROMPT='%{$fg[red]%}%m%{$reset_color%}:%{$fg[green]%}%c%{$reset_color%}$(git_prompt_info) %(!.#.$) ' +PROMPT='%{$fg[red]%}%m%{$reset_color%}:%{$fg[green]%}%c%{$reset_color%}$GIT_PROMPT_INFO %(!.#.$) ' ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[blue]%}(" ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" diff --git a/themes/dieter.zsh-theme b/themes/dieter.zsh-theme index 0a5e9265..d71a810c 100644 --- a/themes/dieter.zsh-theme +++ b/themes/dieter.zsh-theme @@ -26,7 +26,7 @@ local host="@${host_repr[$(hostname)]:-$(hostname)}%{$reset_color%}" # Compacted $PWD local pwd="%{$fg[blue]%}%c%{$reset_color%}" -PROMPT='${time} ${user}${host} ${pwd} $(git_prompt_info)' +PROMPT='${time} ${user}${host} ${pwd} $GIT_PROMPT_INFO' # i would prefer 1 icon that shows the "most drastic" deviation from HEAD, # but lets see how this works out diff --git a/themes/dogenpunk.zsh-theme b/themes/dogenpunk.zsh-theme index f4d65ab7..85eec6f0 100644 --- a/themes/dogenpunk.zsh-theme +++ b/themes/dogenpunk.zsh-theme @@ -6,30 +6,70 @@ # SCREENSHOT: coming soon # ----------------------------------------------------------------------------- -MODE_INDICATOR="%{$fg_bold[red]%}❮%{$reset_color%}%{$fg[red]%}❮❮%{$reset_color%}" -local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%}" +local R="%{$terminfo[sgr0]%}" -PROMPT='%{$fg[blue]%}%m%{$reset_color%}%{$fg_bold[white]%} ओम् %{$reset_color%}%{$fg[cyan]%}%~:%{$reset_color%}$(git_time_since_commit)$(git_prompt_info) -%{$fg[red]%}%!%{$reset_color%} $(prompt_char) ' +MODE_INDICATOR="%{$fg_bold[red]%}❮$R%{$fg[red]%}❮❮$R" +local return_status="%{$fg[red]%}%(?..⏎)$R" -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[green]%}git%{$reset_color%}@%{$bg[white]%}%{$fg[black]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%})" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}!%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="" +PROMPT='%{$fg[blue]%}%m$R%{$fg_bold[white]%} ओम् $R%{$fg[cyan]%}%~:$R$GIT_PROMPT_INFO +%{$fg[red]%}%!$R $(prompt_char) ' -RPROMPT='${return_status}$(git_prompt_status)%{$reset_color%}' +git_prompt_info () +{ + if [ -z "$(git_prompt__git_dir)" ]; then + GIT_PROMPT_INFO='' + GIT_RPROMPT_INFO='' + return + fi + + local prompt='' + + git_prompt__branch + prompt="%{$fg_bold[green]%}git$R@%{$bg[white]%}%{$fg[black]%}$GIT_PROMPT_BRANCH" + + git_prompt__rebase_info + prompt="${prompt}$GIT_PROMPT_REBASE_INFO" + + git_prompt__dirty_state + if [[ "$GIT_PROMPT_DIRTY_STATE_ANY_DIRTY" = 'yes' ]]; then + prompt="${prompt}%{$fg[red]%}!" + fi + GIT_PROMPT_INFO="($(git_time_since_commit)$prompt$R)" + + local rprompt='' + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_ADDED" = 'yes' ]]; then + rprompt="%{$fg[green]%} ✚" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_MODIFIED" = 'yes' ]]; then + rprompt="${rprompt}%{$fg[blue]%} ✹" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_MODIFIED" = 'yes' ]]; then + rprompt="${rprompt}%{$fg[blue]%} ✹" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_DELETED" = 'yes' ]]; then + rprompt="${rprompt}%{$fg[red]%} ✖" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_DELETED" = 'yes' ]]; then + rprompt="${rprompt}%{$fg[red]%} ✖" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_RENAMED" = 'yes' ]]; then + rprompt="${rprompt}%{$fg[magenta]%} ➜" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_UNMERGED" = 'yes' ]]; then + rprompt="${rprompt}%{$fg[yellow]%} ═" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_UNTRACKED" = 'yes' ]]; then + rprompt="${rprompt}%{$fg[cyan]%} ✭" + fi + GIT_RPROMPT_INFO=$rprompt +} -ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" -ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" -ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" -ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" -ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" +RPROMPT='${return_status}$GIT_RPROMPT_INFO$R' function prompt_char() { - git branch >/dev/null 2>/dev/null && echo "%{$fg[green]%}±%{$reset_color%}" && return - hg root >/dev/null 2>/dev/null && echo "%{$fg_bold[red]%}☿%{$reset_color%}" && return - echo "%{$fg[cyan]%}◯ %{$reset_color%}" + git branch >/dev/null 2>/dev/null && echo "%{$fg[green]%}±$R" && return + hg root >/dev/null 2>/dev/null && echo "%{$fg_bold[red]%}☿$R" && return + echo "%{$fg[cyan]%}◯ $R" } # Colors vary depending on time lapsed. @@ -40,7 +80,8 @@ ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}" # Determine the time since last commit. If branch is clean, # use a neutral color, otherwise colors will vary according to time. -function git_time_since_commit() { +git_time_since_commit () +{ if git rev-parse --git-dir > /dev/null 2>&1; then # Only proceed if there is actually a commit. if [[ $(git log 2>&1 > /dev/null | grep -c "^fatal: bad default revision") == 0 ]]; then @@ -71,15 +112,15 @@ function git_time_since_commit() { fi if [ "$HOURS" -gt 24 ]; then - echo "($COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}|" + echo "$COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m$R|" elif [ "$MINUTES" -gt 60 ]; then - echo "($COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}|" + echo "$COLOR${HOURS}h${SUB_MINUTES}m$R|" else - echo "($COLOR${MINUTES}m%{$reset_color%}|" + echo "$COLOR${MINUTES}m$R|" fi else COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" - echo "($COLOR~|" + echo "$COLOR~|" fi fi } diff --git a/themes/dst.zsh-theme b/themes/dst.zsh-theme index 3e2539d5..d7fde764 100644 --- a/themes/dst.zsh-theme +++ b/themes/dst.zsh-theme @@ -10,7 +10,7 @@ function prompt_char { PROMPT='%(?, ,%{$fg[red]%}FAIL%{$reset_color%} ) -%{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}%m%{$reset_color%}: %{$fg_bold[blue]%}%~%{$reset_color%}$(git_prompt_info) +%{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}%m%{$reset_color%}: %{$fg_bold[blue]%}%~%{$reset_color%}$GIT_PROMPT_INFO %_ $(prompt_char) ' RPROMPT='%{$fg[green]%}[%*]%{$reset_color%}' diff --git a/themes/dstufft.zsh-theme b/themes/dstufft.zsh-theme index 5a23fcea..c0326da1 100644 --- a/themes/dstufft.zsh-theme +++ b/themes/dstufft.zsh-theme @@ -9,11 +9,32 @@ function virtualenv_info { } PROMPT=' -%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) +%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$GIT_PROMPT_INFO $(virtualenv_info)$(prompt_char) ' -ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!" -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?" -ZSH_THEME_GIT_PROMPT_CLEAN="" +git_prompt_info () +{ + if [ -z "$(git_prompt__git_dir)" ]; then + GIT_PROMPT_INFO='' + return + fi + + local prompt="" + git_prompt__branch + prompt=$GIT_PROMPT_BRANCH + + git_prompt__rebase_info + prompt="${prompt}$GIT_PROMPT_REBASE_INFO" + + if [[ -n "$prompt" ]]; then + git_prompt__dirty_state + if [[ "$GIT_PROMPT_DIRTY_STATE_ANY_DIRTY" = 'yes' ]]; then + prompt="$prompt%{$fg[green]%}!" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_UNTRACKED" = 'yes' ]]; then + prompt="$prompt%{$fg[green]%}?" + fi + + GIT_PROMPT_INFO=" on %{$fg[magenta]%}$prompt%{$reset_color%}" + fi +} diff --git a/themes/eastwood.zsh-theme b/themes/eastwood.zsh-theme index 8f15f367..cd8a5dc7 100644 --- a/themes/eastwood.zsh-theme +++ b/themes/eastwood.zsh-theme @@ -3,17 +3,28 @@ if [[ -s ~/.rvm/scripts/rvm ]] ; then RPS1="%{$fg[yellow]%}rvm:%{$reset_color%}%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt)%{$reset_color%} $EPS1" fi -ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}[" -ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="" +local R="%{$terminfo[sgr0]%}" -#Customized git status, oh-my-zsh currently does not allow render dirty status before branch -git_custom_status() { - local cb=$(current_branch) - if [ -n "$cb" ]; then - echo "$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX" - fi +git_prompt_info () +{ + if [ -z "$(git_prompt__git_dir)" ]; then + GIT_PROMPT_INFO='' + return + fi + + git_prompt__branch + local cb=$GIT_PROMPT_BRANCH + + git_prompt__rebase_info + cb="${cb}$GIT_PROMPT_REBASE_INFO" + + local dirty + git_prompt__dirty_state + if [[ "$GIT_PROMPT_DIRTY_STATE_ANY_DIRTY" = 'yes' ]]; then + dirty="%{$fg[red]%}*%{$reset_color%}" + fi + + GIT_PROMPT_INFO="$dirty$R%{$fg[green]%}[$cb]$R" } -PROMPT='$(git_custom_status)%{$fg[cyan]%}[%~% ]%{$reset_color%}%B$%b ' +PROMPT='$GIT_PROMPT_INFO%{$fg[cyan]%}[%~% ]%{$reset_color%}%B$%b ' diff --git a/themes/edvardm.zsh-theme b/themes/edvardm.zsh-theme index f9ca1a9e..62551723 100644 --- a/themes/edvardm.zsh-theme +++ b/themes/edvardm.zsh-theme @@ -1,4 +1,4 @@ -PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg_bold[white]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' +PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg_bold[white]%}%c %{$fg_bold[blue]%}$GIT_PROMPT_INFO%{$fg_bold[blue]%} % %{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" diff --git a/themes/fishy.zsh-theme b/themes/fishy.zsh-theme index f9e506ca..6fe339bc 100644 --- a/themes/fishy.zsh-theme +++ b/themes/fishy.zsh-theme @@ -5,16 +5,47 @@ PROMPT='%n@%m %{$fg[$user_color]%}%~%{$reset_color%}%(!.#.>) ' PROMPT2='%{$fg[red]%}\ %{$reset_color%}' local return_status="%{$fg_bold[red]%}%(?..%?)%{$reset_color%}" -RPROMPT='${return_status}$(git_prompt_info)$(git_prompt_status)%{$reset_color%}' +RPROMPT='${return_status}$GIT_PROMPT_INFO%{$reset_color%}' -ZSH_THEME_GIT_PROMPT_PREFIX=" " -ZSH_THEME_GIT_PROMPT_SUFFIX="" -ZSH_THEME_GIT_PROMPT_DIRTY="" -ZSH_THEME_GIT_PROMPT_CLEAN="" +git_prompt_info () +{ + if [ -z "$(git_prompt__git_dir)" ]; then + GIT_PROMPT_INFO='' + return + fi -ZSH_THEME_GIT_PROMPT_ADDED="%{$fg_bold[green]%}+" -ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg_bold[blue]%}!" -ZSH_THEME_GIT_PROMPT_DELETED="%{$fg_bold[red]%}-" -ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg_bold[magenta]%}>" -ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg_bold[yellow]%}#" -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[cyan]%}?" + local prompt='' + + git_prompt__branch + prompt=" $GIT_PROMPT_BRANCH" + + git_prompt__rebase_info + prompt="${prompt}$GIT_PROMPT_REBASE_INFO" + + git_prompt__dirty_state + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_ADDED" = 'yes' ]]; then + prompt="${prompt}%{$fg[green]%} +" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_MODIFIED" = 'yes' ]]; then + prompt="${prompt}%{$fg[blue]%} !" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_MODIFIED" = 'yes' ]]; then + prompt="${prompt}%{$fg[blue]%} !" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_DELETED" = 'yes' ]]; then + prompt="${prompt}%{$fg[red]%} -" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_DELETED" = 'yes' ]]; then + prompt="${prompt}%{$fg[red]%} -" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_RENAMED" = 'yes' ]]; then + prompt="${prompt}%{$fg[magenta]%} >" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_UNMERGED" = 'yes' ]]; then + prompt="${prompt}%{$fg[yellow]%} #" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_UNTRACKED" = 'yes' ]]; then + prompt="${prompt}%{$fg[cyan]%} ?" + fi + GIT_PROMPT_INFO=$prompt +} diff --git a/themes/flazz.zsh-theme b/themes/flazz.zsh-theme index 280794f2..d4233a40 100644 --- a/themes/flazz.zsh-theme +++ b/themes/flazz.zsh-theme @@ -5,7 +5,7 @@ fi local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" -PROMPT='%m%{${fg_bold[magenta]}%} :: %{$reset_color%}%{${fg[green]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}%#%{${reset_color}%} ' +PROMPT='%m%{${fg_bold[magenta]}%} :: %{$reset_color%}%{${fg[green]}%}%3~ $GIT_PROMPT_INFO%{${fg_bold[$CARETCOLOR]}%}%#%{${reset_color}%} ' RPS1='$(vi_mode_prompt_info) ${return_code}' diff --git a/themes/fletcherm.zsh-theme b/themes/fletcherm.zsh-theme index e9618854..dfa6c444 100644 --- a/themes/fletcherm.zsh-theme +++ b/themes/fletcherm.zsh-theme @@ -1,5 +1,5 @@ # Copied from old version of tonotdo's theme. LSCOLORS modified. -PROMPT='%{$fg_no_bold[cyan]%}%n%{$fg_no_bold[magenta]%}•%{$fg_no_bold[green]%}%3~$(git_prompt_info)%{$reset_color%}» ' +PROMPT='%{$fg_no_bold[cyan]%}%n%{$fg_no_bold[magenta]%}•%{$fg_no_bold[green]%}%3~$GIT_PROMPT_INFO%{$reset_color%}» ' RPROMPT='[%*]' # git theming diff --git a/themes/frisk.zsh-theme b/themes/frisk.zsh-theme index f181aec9..3d91c005 100644 --- a/themes/frisk.zsh-theme +++ b/themes/frisk.zsh-theme @@ -1,5 +1,5 @@ PROMPT=$' -%{$fg[blue]%}%/%{$reset_color%} $(git_prompt_info)%{$fg[white]%}[%n@%m]%{$reset_color%} %{$fg[white]%}[%T]%{$reset_color%} +%{$fg[blue]%}%/%{$reset_color%} $GIT_PROMPT_INFO%{$fg[white]%}[%n@%m]%{$reset_color%} %{$fg[white]%}[%T]%{$reset_color%} %{$fg_bold[black]%}>%{$reset_color%} ' PROMPT2="%{$fg_blod[black]%}%_> %{$reset_color%}" diff --git a/themes/fwalch.zsh-theme b/themes/fwalch.zsh-theme index 24edf55c..0c9c936b 100644 --- a/themes/fwalch.zsh-theme +++ b/themes/fwalch.zsh-theme @@ -1,4 +1,4 @@ -PROMPT='%{$fg_bold[green]%}%p %{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' +PROMPT='%{$fg_bold[green]%}%p %{$fg[cyan]%}%c%{$fg_bold[blue]%}$GIT_PROMPT_INFO%{$fg_bold[blue]%} % %{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" diff --git a/themes/gallifrey.zsh-theme b/themes/gallifrey.zsh-theme index fce7cb92..598e4151 100644 --- a/themes/gallifrey.zsh-theme +++ b/themes/gallifrey.zsh-theme @@ -1,7 +1,7 @@ # ZSH Theme - Preview: http://img.skitch.com/20091113-qqtd3j8xinysujg5ugrsbr7x1y.jpg local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" -PROMPT='%{$fg[green]%}%m%{$reset_color%} %2~ $(git_prompt_info)%{$reset_color%}%B»%b ' +PROMPT='%{$fg[green]%}%m%{$reset_color%} %2~ $GIT_PROMPT_INFO%{$reset_color%}%B»%b ' RPS1="${return_code}" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" diff --git a/themes/gallois.zsh-theme b/themes/gallois.zsh-theme index be8fe099..278435e8 100644 --- a/themes/gallois.zsh-theme +++ b/themes/gallois.zsh-theme @@ -1,19 +1,30 @@ -ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}[" -ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="" +git_prompt_info () +{ + if [ -z "$(git_prompt__git_dir)" ]; then + GIT_PROMPT_INFO='' + return + fi -#Customized git status, oh-my-zsh currently does not allow render dirty status before branch -git_custom_status() { - local cb=$(current_branch) - if [ -n "$cb" ]; then - echo "$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX" - fi + git_prompt__branch + local cb=$GIT_PROMPT_BRANCH + + git_prompt__rebase_info + cb="${cb}$GIT_PROMPT_REBASE_INFO" + + local dirty + git_prompt__dirty_state + if [[ "$GIT_PROMPT_DIRTY_STATE_ANY_DIRTY" = 'yes' ]]; then + dirty="%{$fg[red]%}*%{$reset_color%}" + fi + + local R="%{$terminfo[sgr0]%}" + + GIT_PROMPT_INFO="$dirty$R%{$fg[green]%}[$cb]$R" } #RVM and git settings if [[ -s ~/.rvm/scripts/rvm ]] ; then - RPS1='$(git_custom_status)%{$fg[red]%}[`~/.rvm/bin/rvm-prompt`]%{$reset_color%} $EPS1' + RPS1='$GIT_PROMPT_INFO%{$fg[red]%}[`~/.rvm/bin/rvm-prompt`]%{$reset_color%} $EPS1' fi PROMPT='%{$fg[cyan]%}[%~% ]%(?.%{$fg[green]%}.%{$fg[red]%})%B$%b ' diff --git a/themes/garyblessington.zsh-theme b/themes/garyblessington.zsh-theme index b4f84a71..27a27e9b 100644 --- a/themes/garyblessington.zsh-theme +++ b/themes/garyblessington.zsh-theme @@ -1,4 +1,4 @@ -PROMPT='%{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}% %{$reset_color%}: ' +PROMPT='%{$fg[cyan]%}%c%{$fg_bold[blue]%}$GIT_PROMPT_INFO%{$fg_bold[blue]%}% %{$reset_color%}: ' ZSH_THEME_GIT_PROMPT_PREFIX="(%{$fg[blue]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" diff --git a/themes/gentoo.zsh-theme b/themes/gentoo.zsh-theme index cba143d4..be0a6cc0 100644 --- a/themes/gentoo.zsh-theme +++ b/themes/gentoo.zsh-theme @@ -1,4 +1,4 @@ -PROMPT='%(!.%{$fg_bold[red]%}.%{$fg_bold[green]%}%n@)%m %{$fg_bold[blue]%}%(!.%1~.%~) $(git_prompt_info)%#%{$reset_color%} ' +PROMPT='%(!.%{$fg_bold[red]%}.%{$fg_bold[green]%}%n@)%m %{$fg_bold[blue]%}%(!.%1~.%~) $GIT_PROMPT_INFO%#%{$reset_color%} ' ZSH_THEME_GIT_PROMPT_PREFIX="(" ZSH_THEME_GIT_PROMPT_SUFFIX=") " diff --git a/themes/geoffgarside.zsh-theme b/themes/geoffgarside.zsh-theme index 675ec720..20a85c1d 100644 --- a/themes/geoffgarside.zsh-theme +++ b/themes/geoffgarside.zsh-theme @@ -1,5 +1,5 @@ -# PROMPT="[%*] %n:%c $(git_prompt_info)%(!.#.$) " -PROMPT='[%*] %{$fg[cyan]%}%n%{$reset_color%}:%{$fg[green]%}%c%{$reset_color%}$(git_prompt_info) %(!.#.$) ' +# PROMPT="[%*] %n:%c $GIT_PROMPT_INFO%(!.#.$) " +PROMPT='[%*] %{$fg[cyan]%}%n%{$reset_color%}:%{$fg[green]%}%c%{$reset_color%}$GIT_PROMPT_INFO %(!.#.$) ' ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[yellow]%}git:(" ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" diff --git a/themes/gozilla.zsh-theme b/themes/gozilla.zsh-theme index c6b752e9..ace15be2 100644 --- a/themes/gozilla.zsh-theme +++ b/themes/gozilla.zsh-theme @@ -1,15 +1,51 @@ -PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' +local R="%{$terminfo[sgr0]%}" -ZSH_THEME_GIT_PROMPT_PREFIX="(" -ZSH_THEME_GIT_PROMPT_SUFFIX=")" -ZSH_THEME_GIT_PROMPT_DIRTY="" -ZSH_THEME_GIT_PROMPT_CLEAN="" +PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$GIT_PROMPT_INFO % $R' +RPROMPT='$GIT_RPROMPT_INFO$R' -RPROMPT='$(git_prompt_status)%{$reset_color%}' +git_prompt_info () +{ + if [ -z "$(git_prompt__git_dir)" ]; then + GIT_PROMPT_INFO='' + GIT_RPROMPT_INFO='' + return + fi -ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%} ✈" -ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%} ✭" -ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✗" -ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%} ➦" -ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%} ✂" -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%} ✱" + local prompt='' + + git_prompt__branch + prompt="$GIT_PROMPT_BRANCH" + + git_prompt__rebase_info + prompt="${prompt}$GIT_PROMPT_REBASE_INFO" + + GIT_PROMPT_INFO="($prompt)" + + local rprompt='' + git_prompt__dirty_state + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_ADDED" = 'yes' ]]; then + rprompt="%{$fg[cyan]%} ✈" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_MODIFIED" = 'yes' ]]; then + rprompt="${rprompt}%{$fg[yellow]%} ✭" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_MODIFIED" = 'yes' ]]; then + rprompt="${rprompt}%{$fg[yellow]%} ✭" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_DELETED" = 'yes' ]]; then + rprompt="${rprompt}%{$fg[red]%} ✗" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_DELETED" = 'yes' ]]; then + rprompt="${rprompt}%{$fg[red]%} ✗" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_RENAMED" = 'yes' ]]; then + rprompt="${rprompt}%{$fg[blue]%} ➦" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_UNMERGED" = 'yes' ]]; then + rprompt="${rprompt}%{$fg[magenta]%} ✂" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_UNTRACKED" = 'yes' ]]; then + rprompt="${rprompt}%{$fg[grey]%} ✱" + fi + GIT_RPROMPT_INFO=$rprompt +} diff --git a/themes/jbergantine.zsh-theme b/themes/jbergantine.zsh-theme index d84247cf..0232fdb1 100644 --- a/themes/jbergantine.zsh-theme +++ b/themes/jbergantine.zsh-theme @@ -1,4 +1,4 @@ -PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[white]%}$(git_prompt_info)%{$fg_bold[white]%} % %{$reset_color%}' +PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[white]%}$GIT_PROMPT_INFO%{$fg_bold[white]%} % %{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" diff --git a/themes/jonathan.zsh-theme b/themes/jonathan.zsh-theme index 79d0d21f..491dbd49 100644 --- a/themes/jonathan.zsh-theme +++ b/themes/jonathan.zsh-theme @@ -32,7 +32,51 @@ preexec () { } -setprompt () { +git_prompt_info () +{ + if [ -z "$(git_prompt__git_dir)" ]; then + GIT_PROMPT_INFO='' + return + fi + + local prompt='' + + git_prompt__branch + prompt=" on %{$fg[green]%}$GIT_PROMPT_BRANCH" + + git_prompt__rebase_info + prompt="${prompt}$GIT_PROMPT_REBASE_INFO%{$terminfo[sgr0]%}" + + git_prompt__dirty_state + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_ADDED" = 'yes' ]]; then + prompt="${prompt}%{$fg[green]%} ✚" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_MODIFIED" = 'yes' ]]; then + prompt="${prompt}%{$fg[blue]%} ✹" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_MODIFIED" = 'yes' ]]; then + prompt="${prompt}%{$fg[blue]%} ✹" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_DELETED" = 'yes' ]]; then + prompt="${prompt}%{$fg[red]%} ✖" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_DELETED" = 'yes' ]]; then + prompt="${prompt}%{$fg[red]%} ✖" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_RENAMED" = 'yes' ]]; then + prompt="${prompt}%{$fg[magenta]%} ➜" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_UNMERGED" = 'yes' ]]; then + prompt="${prompt}%{$fg[yellow]%} ═" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_UNTRACKED" = 'yes' ]]; then + prompt="${prompt}%{$fg[cyan]%} ✭" + fi + GIT_PROMPT_INFO=$prompt +} + +setprompt () +{ ### # Need this so the prompt will work. @@ -53,20 +97,6 @@ setprompt () { done PR_NO_COLOUR="%{$terminfo[sgr0]%}" - ### - # Modify Git prompt - ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[green]%}" - ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" - ZSH_THEME_GIT_PROMPT_DIRTY="" - ZSH_THEME_GIT_PROMPT_CLEAN="" - - ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" - ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" - ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" - ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" - ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" - ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" - ### # See if we can use extended characters to look nicer. @@ -119,7 +149,7 @@ $PR_GREY)$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_URCORNER$PR_SHIFT_OUT\ $PR_CYAN$PR_SHIFT_IN$PR_LLCORNER$PR_BLUE$PR_HBAR$PR_SHIFT_OUT(\ $PR_YELLOW%D{%H:%M:%S}\ -$PR_LIGHT_BLUE%{$reset_color%}`git_prompt_info``git_prompt_status`$PR_BLUE)$PR_CYAN$PR_SHIFT_IN$PR_HBAR\ +$PR_LIGHT_BLUE%{$reset_color%}$GIT_PROMPT_INFO$PR_BLUE)$PR_CYAN$PR_SHIFT_IN$PR_HBAR\ $PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\ >$PR_NO_COLOUR ' diff --git a/themes/josh.zsh-theme b/themes/josh.zsh-theme index d6c64da8..b3ed027e 100644 --- a/themes/josh.zsh-theme +++ b/themes/josh.zsh-theme @@ -31,7 +31,7 @@ function josh_prompt { prompt=" $prompt" done - prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info)%{$reset_color%} $(git_prompt_info)" + prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info)%{$reset_color%} $GIT_PROMPT_INFO" echo $prompt } diff --git a/themes/jreese.zsh-theme b/themes/jreese.zsh-theme index 0fa6b4ec..33950923 100644 --- a/themes/jreese.zsh-theme +++ b/themes/jreese.zsh-theme @@ -4,7 +4,7 @@ if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" PROMPT='%{$fg[$NCOLOR]%}%n%{$fg[green]%}@%m%{$reset_color%} %~ \ -$(git_prompt_info)\ +$GIT_PROMPT_INFO\ %{$fg[red]%}%(!.#.»)%{$reset_color%} ' PROMPT2='%{$fg[red]%}\ %{$reset_color%}' RPS1='${return_code}' diff --git a/themes/jtriley.zsh-theme b/themes/jtriley.zsh-theme index 15d77ed2..aad8af24 100644 --- a/themes/jtriley.zsh-theme +++ b/themes/jtriley.zsh-theme @@ -1,4 +1,4 @@ -#PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' +#PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$GIT_PROMPT_INFO%{$fg_bold[blue]%} % %{$reset_color%}' PROMPT="%{$fg_bold[cyan]%}%T%{$fg_bold[green]%} %{$fg_bold[white]%}%n%{$fg[magenta]%}@%{$fg_bold[white]%}%m %{$fg_bold[green]%}%d %{$fg_bold[yellow]%}%% %{$reset_color%}" diff --git a/themes/juanghurtado.zsh-theme b/themes/juanghurtado.zsh-theme index 3ca50cee..4dff6255 100644 --- a/themes/juanghurtado.zsh-theme +++ b/themes/juanghurtado.zsh-theme @@ -1,6 +1,5 @@ # ------------------------------------------------------------------------ # Juan G. Hurtado oh-my-zsh theme -# (Needs Git plugin for current_branch method) # ------------------------------------------------------------------------ # Color shortcuts @@ -16,31 +15,68 @@ WHITE_BOLD=$fg_bold[white] BLUE_BOLD=$fg_bold[blue] RESET_COLOR=$reset_color -# Format for git_prompt_info() -ZSH_THEME_GIT_PROMPT_PREFIX="" -ZSH_THEME_GIT_PROMPT_SUFFIX="" -# Format for parse_git_dirty() -ZSH_THEME_GIT_PROMPT_DIRTY=" %{$RED%}(*)" -ZSH_THEME_GIT_PROMPT_CLEAN="" +# Prompt format +PROMPT=' +%{$GREEN_BOLD%}%n@%m%{$WHITE%}:%{$YELLOW%}%~%u$GIT_PROMPT_INFO%{$RESET_COLOR%} +%{$BLUE%}>%{$RESET_COLOR%} ' +RPROMPT='%{$GREEN_BOLD%}$GIT_RPROMPT_INFO%{$RESET_COLOR%}' -# Format for git_prompt_status() -ZSH_THEME_GIT_PROMPT_UNMERGED=" %{$RED%}unmerged" -ZSH_THEME_GIT_PROMPT_DELETED=" %{$RED%}deleted" -ZSH_THEME_GIT_PROMPT_RENAMED=" %{$YELLOW%}renamed" -ZSH_THEME_GIT_PROMPT_MODIFIED=" %{$YELLOW%}modified" -ZSH_THEME_GIT_PROMPT_ADDED=" %{$GREEN%}added" -ZSH_THEME_GIT_PROMPT_UNTRACKED=" %{$WHITE%}untracked" +git_prompt_info () +{ + if [ -z "$(git_prompt__git_dir)" ]; then + GIT_PROMPT_INFO='' + GIT_RPROMPT_INFO='' + return + fi -# Format for git_prompt_ahead() -ZSH_THEME_GIT_PROMPT_AHEAD=" %{$RED%}(!)" + local dirty='' + git_prompt__dirty_state + if [[ "$GIT_PROMPT_DIRTY_STATE_ANY_DIRTY" = 'yes' ]]; then + dirty=" %{$RED%}(*)" + fi + git_prompt__upstream + if [[ "$GIT_PROMPT_UPSTREAM_STATE" != "=" ]]; then + local upstream=" %{$RED%}($GIT_PROMPT_UPSTREAM_STATE)" + fi -# Format for git_prompt_long_sha() and git_prompt_short_sha() -ZSH_THEME_GIT_PROMPT_SHA_BEFORE=" %{$WHITE%}[%{$YELLOW%}" -ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$WHITE%}]" + GIT_PROMPT_INFO="$dirty$upstream" -# Prompt format -PROMPT=' -%{$GREEN_BOLD%}%n@%m%{$WHITE%}:%{$YELLOW%}%~%u$(parse_git_dirty)$(git_prompt_ahead)%{$RESET_COLOR%} -%{$BLUE%}>%{$RESET_COLOR%} ' -RPROMPT='%{$GREEN_BOLD%}$(current_branch)$(git_prompt_short_sha)$(git_prompt_status)%{$RESET_COLOR%}' + git_prompt__branch + local current_branch="$GIT_PROMPT_BRANCH" + + git_prompt__rebase_info + current_branch="${current_branch}$GIT_PROMPT_REBASE_INFO" + + local sha=$(git rev-parse --short HEAD 2> /dev/null) + if [[ -n "$sha" ]]; then + sha=" %{$WHITE%}[%{$YELLOW%}$sha%{$WHITE%}]" + fi + + local git_status='' + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_ADDED" = 'yes' ]]; then + git_status="%{$GREEN%} added" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_MODIFIED" = 'yes' ]]; then + git_status="${git_status}%{$YELLOW%} modified" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_MODIFIED" = 'yes' ]]; then + git_status="${git_status}%{$YELLOW%} modified" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_DELETED" = 'yes' ]]; then + git_status="${git_status}%{$RED%} deleted" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_DELETED" = 'yes' ]]; then + git_status="${git_status}%{$RED%} deleted" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_RENAMED" = 'yes' ]]; then + git_status="${git_status}%{$YELLOW%} renamed" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_UNMERGED" = 'yes' ]]; then + git_status="${git_status}%{$RED%} unmerged" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_UNTRACKED" = 'yes' ]]; then + git_status="${git_status}%{$WHITE%} untracked" + fi + GIT_RPROMPT_INFO="$current_branch$sha$git_status" +} diff --git a/themes/kardan.zsh-theme b/themes/kardan.zsh-theme index 59c93803..33002a8e 100644 --- a/themes/kardan.zsh-theme +++ b/themes/kardan.zsh-theme @@ -5,7 +5,7 @@ function get_host { } PROMPT='> ' -RPROMPT='%~$(git_prompt_info)$(get_host)' +RPROMPT='%~$GIT_PROMPT_INFO$(get_host)' ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}✗%{$reset_color%}" ZSH_THEME_GIT_PROMPT_PREFIX="(" diff --git a/themes/kennethreitz.zsh-theme b/themes/kennethreitz.zsh-theme index 109be0c2..897e243d 100644 --- a/themes/kennethreitz.zsh-theme +++ b/themes/kennethreitz.zsh-theme @@ -1,7 +1,7 @@ local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" PROMPT='%{$fg[green]%}%c \ -$(git_prompt_info)\ +$GIT_PROMPT_INFO\ %{$fg[red]%}%(!.#.»)%{$reset_color%} ' PROMPT2='%{$fg[red]%}\ %{$reset_color%}' RPS1='%{$fg[blue]%}%~%{$reset_color%} ${return_code} ' diff --git a/themes/kphoen.zsh-theme b/themes/kphoen.zsh-theme index 0e9b5e73..6c3b216e 100644 --- a/themes/kphoen.zsh-theme +++ b/themes/kphoen.zsh-theme @@ -6,45 +6,66 @@ # SCREENSHOT: # ------------------------------------------------------------------------------ - if [[ "$TERM" != "dumb" ]] && [[ "$DISABLE_LS_COLORS" != "true" ]]; then - PROMPT='[%{$fg[red]%}%n%{$reset_color%}@%{$fg[magenta]%}%m%{$reset_color%}:%{$fg[blue]%}%~%{$reset_color%}$(git_prompt_info)] -%# ' + local R="%{$terminfo[sgr0]%}" + local MAGENTA="%{$fg[magenta]%}" + local YELLOW="%{$fg[yellow]%}" + local GREEN="%{$fg[green]%}" + local BLUE="%{$fg[blue]%}" + local CYAN="%{$fg[cyan]%}" + local RED="%{$fg[red]%}" +fi - ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[green]%}" - ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" - ZSH_THEME_GIT_PROMPT_DIRTY="" - ZSH_THEME_GIT_PROMPT_CLEAN="" +PROMPT='[$RED%n$R@$MAGENTA%m$R:$BLUE%~$R$GIT_PROMPT_INFO] +%# ' - # display exitcode on the right when >0 - return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" +# display exitcode on the right when >0 +return_code="%(?..$RED%? ↵$R)" +RPROMPT='${return_code}$GIT_RPROMPT_INFO$R' - RPROMPT='${return_code}$(git_prompt_status)%{$reset_color%}' +git_prompt_info () +{ + if [ -z "$(git_prompt__git_dir)" ]; then + GIT_PROMPT_INFO='' + GIT_RPROMPT_INFO='' + return + fi - ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" - ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" - ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" - ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" - ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" - ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" -else - PROMPT='[%n@%m:%~$(git_prompt_info)] -%# ' + local branch='' - ZSH_THEME_GIT_PROMPT_PREFIX=" on" - ZSH_THEME_GIT_PROMPT_SUFFIX="" - ZSH_THEME_GIT_PROMPT_DIRTY="" - ZSH_THEME_GIT_PROMPT_CLEAN="" + git_prompt__branch + branch="$GIT_PROMPT_BRANCH" - # display exitcode on the right when >0 - return_code="%(?..%? ↵)" + git_prompt__rebase_info + branch="${branch}$GIT_PROMPT_REBASE_INFO" - RPROMPT='${return_code}$(git_prompt_status)' + GIT_PROMPT_INFO=" on $GREEN${branch}$R" - ZSH_THEME_GIT_PROMPT_ADDED=" ✚" - ZSH_THEME_GIT_PROMPT_MODIFIED=" ✹" - ZSH_THEME_GIT_PROMPT_DELETED=" ✖" - ZSH_THEME_GIT_PROMPT_RENAMED=" ➜" - ZSH_THEME_GIT_PROMPT_UNMERGED=" ═" - ZSH_THEME_GIT_PROMPT_UNTRACKED=" ✭" -fi + local rprompt='' + git_prompt__dirty_state + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_ADDED" = 'yes' ]]; then + rprompt="$GREEN ✚" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_MODIFIED" = 'yes' ]]; then + rprompt="${rprompt}$BLUE ✹" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_MODIFIED" = 'yes' ]]; then + rprompt="${rprompt}$BLUE ✹" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_DELETED" = 'yes' ]]; then + rprompt="${rprompt}$RED ✖" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_DELETED" = 'yes' ]]; then + rprompt="${rprompt}$RED ✖" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_RENAMED" = 'yes' ]]; then + rprompt="${rprompt}$MAGENTA ➜" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_UNMERGED" = 'yes' ]]; then + rprompt="${rprompt}$YELLOW ═" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_UNTRACKED" = 'yes' ]]; then + rprompt="${rprompt}$CYAN ✭" + fi + GIT_RPROMPT_INFO=$rprompt +} diff --git a/themes/lambda.zsh-theme b/themes/lambda.zsh-theme index 63292d33..56f1ab5b 100644 --- a/themes/lambda.zsh-theme +++ b/themes/lambda.zsh-theme @@ -1,6 +1,6 @@ # ZSH Theme - Preview: http://cl.ly/350F0F0k1M2y3A2i3p1S -PROMPT='λ %~/ $(git_prompt_info)%{$reset_color%}' +PROMPT='λ %~/ $GIT_PROMPT_INFO%{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " diff --git a/themes/lukerandall.zsh-theme b/themes/lukerandall.zsh-theme index 24a0612b..54007aa7 100644 --- a/themes/lukerandall.zsh-theme +++ b/themes/lukerandall.zsh-theme @@ -3,7 +3,7 @@ local return_code="%(?..%{$fg_bold[red]%}%? ↵%{$reset_color%})" -PROMPT='%{$fg_bold[green]%}%n@%m%{$reset_color%} %{$fg_bold[blue]%}%2~%{$reset_color%} $(git_prompt_info)%{$reset_color%}%B»%b ' +PROMPT='%{$fg_bold[green]%}%n@%m%{$reset_color%} %{$fg_bold[blue]%}%2~%{$reset_color%} $GIT_PROMPT_INFO%{$reset_color%}%B»%b ' RPS1="${return_code}" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}(" diff --git a/themes/macovsky-ruby.zsh-theme b/themes/macovsky-ruby.zsh-theme index 4eb41023..be4e8d51 100644 --- a/themes/macovsky-ruby.zsh-theme +++ b/themes/macovsky-ruby.zsh-theme @@ -1,7 +1,7 @@ # ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" -PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b ' +PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $GIT_PROMPT_INFO%{$reset_color%}%B$%b ' RPS1="${return_code}" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" diff --git a/themes/macovsky.zsh-theme b/themes/macovsky.zsh-theme index 4eb41023..be4e8d51 100644 --- a/themes/macovsky.zsh-theme +++ b/themes/macovsky.zsh-theme @@ -1,7 +1,7 @@ # ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" -PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b ' +PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $GIT_PROMPT_INFO%{$reset_color%}%B$%b ' RPS1="${return_code}" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" diff --git a/themes/maran.zsh-theme b/themes/maran.zsh-theme index 6fba0468..e196cd8d 100644 --- a/themes/maran.zsh-theme +++ b/themes/maran.zsh-theme @@ -1,6 +1,6 @@ # Theme with full path names and hostname # Handy if you work on different servers all the time; -PROMPT='%{$fg[cyan]%}%n%{$reset_color%}@%{$fg[yellow]%}%M:%{$fg[green]%}%/%{$reset_color%} $(git_prompt_info) %(!.#.$) ' +PROMPT='%{$fg[cyan]%}%n%{$reset_color%}@%{$fg[yellow]%}%M:%{$fg[green]%}%/%{$reset_color%} $GIT_PROMPT_INFO %(!.#.$) ' ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[cyan]%}git:(" ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" diff --git a/themes/mgutz.zsh-theme b/themes/mgutz.zsh-theme index dcf32704..b3fb8767 100644 --- a/themes/mgutz.zsh-theme +++ b/themes/mgutz.zsh-theme @@ -1,4 +1,4 @@ -PROMPT='%{$fg_bold[magenta]%}%1~$(git_prompt_info) %{$fg_bold[magenta]%}%# %{$reset_color%}' +PROMPT='%{$fg_bold[magenta]%}%1~$GIT_PROMPT_INFO %{$fg_bold[magenta]%}%# %{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[yellow]%}[" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" diff --git a/themes/minimal.zsh-theme b/themes/minimal.zsh-theme index d3c9e366..eb999d3c 100644 --- a/themes/minimal.zsh-theme +++ b/themes/minimal.zsh-theme @@ -3,13 +3,5 @@ ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}●%{$reset_color%}" ZSH_THEME_GIT_PROMPT_CLEAN="" -#Customized git status, oh-my-zsh currently does not allow render dirty status before branch -git_custom_status() { - local cb=$(current_branch) - if [ -n "$cb" ]; then - echo "- $ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" - fi -} - -PROMPT='%2~ $(git_custom_status) »%b ' +PROMPT='%2~ $GIT_PROMPT_INFO »%b ' diff --git a/themes/mrtazz.zsh-theme b/themes/mrtazz.zsh-theme index 214ba5a4..d73e1ad7 100644 --- a/themes/mrtazz.zsh-theme +++ b/themes/mrtazz.zsh-theme @@ -1,5 +1,5 @@ PROMPT='%{$fg_bold[red]%}%m%{$reset_color%}:%{$fg[cyan]%}%c%{$reset_color%}:%# ' -RPROMPT='%{$fg_bold[green]%}$(git_prompt_info)%{$reset_color%}% ' +RPROMPT='%{$fg_bold[green]%}$GIT_PROMPT_INFO%{$reset_color%}% ' ZSH_THEME_GIT_PROMPT_PREFIX="<%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" diff --git a/themes/murilasso.zsh-theme b/themes/murilasso.zsh-theme index 310357b4..9bf5e0b2 100644 --- a/themes/murilasso.zsh-theme +++ b/themes/murilasso.zsh-theme @@ -2,7 +2,7 @@ local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}' local current_dir='%{$terminfo[bold]$fg[blue]%}%~%{$reset_color%}' local rvm_ruby='%{$fg[red]%}$(rvm_prompt_info)%{$reset_color%}' -local git_branch='%{$fg[blue]%}$(git_prompt_info)%{$reset_color%}' +local git_branch='%{$fg[blue]%}$GIT_PROMPT_INFO%{$reset_color%}' PROMPT="${user_host}:${current_dir} ${rvm_ruby} ${git_branch} %B$%b " diff --git a/themes/muse.zsh-theme b/themes/muse.zsh-theme index 4bd8fb82..83f42431 100644 --- a/themes/muse.zsh-theme +++ b/themes/muse.zsh-theme @@ -1,30 +1,71 @@ #!/usr/bin/env zsh -#local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" +local R="%{$terminfo[sgr0]%}" +#local return_code="%(?..%{$fg[red]%}%? ↵$R)" setopt promptsubst autoload -U add-zsh-hook -PROMPT_SUCCESS_COLOR=$FG[117] PROMPT_FAILURE_COLOR=$FG[124] PROMPT_VCS_INFO_COLOR=$FG[242] PROMPT_PROMPT=$FG[077] GIT_DIRTY_COLOR=$FG[133] GIT_CLEAN_COLOR=$FG[118] -GIT_PROMPT_INFO=$FG[012] +GIT_PROMPT_DEFAULT=$FG[012] -PROMPT='%{$PROMPT_SUCCESS_COLOR%}%~%{$reset_color%} %{$GIT_PROMPT_INFO%}$(git_prompt_info)%{$GIT_DIRTY_COLOR%}$(git_prompt_status) %{$reset_color%}%{$PROMPT_PROMPT%}ᐅ%{$reset_color%} ' +PROMPT='%{$FG[117]%}%~ $GIT_PROMPT_INFO $R%{$PROMPT_PROMPT%}ᐅ$R ' #RPS1="${return_code}" -ZSH_THEME_GIT_PROMPT_PREFIX="(" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$GIT_PROMPT_INFO%})" -ZSH_THEME_GIT_PROMPT_DIRTY=" %{$GIT_DIRTY_COLOR%}✘" -ZSH_THEME_GIT_PROMPT_CLEAN=" %{$GIT_CLEAN_COLOR%}✔" - -ZSH_THEME_GIT_PROMPT_ADDED="%{$FG[082]%}✚%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_MODIFIED="%{$FG[166]%}✹%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DELETED="%{$FG[160]%}✖%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_RENAMED="%{$FG[220]%}➜%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_UNMERGED="%{$FG[082]%}═%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$FG[190]%}✭%{$reset_color%}" +git_prompt_info () +{ + if [ -z "$(git_prompt__git_dir)" ]; then + GIT_PROMPT_INFO='' + GIT_RPROMPT_INFO='' + return + fi + + local branch='' + + git_prompt__branch + branch="$GIT_PROMPT_BRANCH" + + git_prompt__rebase_info + branch="${branch}$GIT_PROMPT_REBASE_INFO" + + local dirty='' + git_prompt__dirty_state + if [[ "$GIT_PROMPT_DIRTY_STATE_ANY_DIRTY" = 'yes' ]]; then + dirty=" %{$GIT_DIRTY_COLOR%}✘" + else + dirty=" %{$GIT_CLEAN_COLOR%}✔" + fi + + local prompt="($R%{${branch}${dirty}%{$FG[012]%})" + + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_ADDED" = 'yes' ]]; then + prompt="${prompt}%{$FG[082]%}✚" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_MODIFIED" = 'yes' ]]; then + prompt="${prompt}%{$FG[166]%}✹" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_MODIFIED" = 'yes' ]]; then + prompt="${prompt}%{$FG[166]%}✹" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_DELETED" = 'yes' ]]; then + prompt="${prompt}%{$FG[160]%}✖" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_DELETED" = 'yes' ]]; then + prompt="${prompt}%{$FG[160]%}✖" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_RENAMED" = 'yes' ]]; then + prompt="${prompt}%{$FG[220]%}➜" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_UNMERGED" = 'yes' ]]; then + prompt="${prompt}%{$FG[082]%}═" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_UNTRACKED" = 'yes' ]]; then + prompt="${prompt}%{$FG[90]%}✭" + fi + GIT_PROMPT_INFO="$prompt$R" +} diff --git a/themes/nanotech.zsh-theme b/themes/nanotech.zsh-theme index 5d333163..4bd1e876 100644 --- a/themes/nanotech.zsh-theme +++ b/themes/nanotech.zsh-theme @@ -1,5 +1,5 @@ PROMPT='%F{green}%2c%F{blue} [%f ' -RPROMPT='$(git_prompt_info) %F{blue}] %F{green}%D{%L:%M} %F{yellow}%D{%p}%f' +RPROMPT='$GIT_PROMPT_INFO %F{blue}] %F{green}%D{%L:%M} %F{yellow}%D{%p}%f' ZSH_THEME_GIT_PROMPT_PREFIX="%F{yellow}" ZSH_THEME_GIT_PROMPT_SUFFIX="%f" diff --git a/themes/obraun.zsh-theme b/themes/obraun.zsh-theme index 08d13766..096fc470 100644 --- a/themes/obraun.zsh-theme +++ b/themes/obraun.zsh-theme @@ -2,7 +2,7 @@ if [ "$(whoami)" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" -PROMPT='%{$fg[green]%}[%*]%{$reset_color%} %{$fg_no_bold[cyan]%}%n %{${fg_bold[blue]}%}::%{$reset_color%} %{$fg[yellow]%}%m%{$reset_color%} %{$fg_no_bold[magenta]%} ➜ %{$reset_color%} %{${fg[green]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}»%{${reset_color}%} ' +PROMPT='%{$fg[green]%}[%*]%{$reset_color%} %{$fg_no_bold[cyan]%}%n %{${fg_bold[blue]}%}::%{$reset_color%} %{$fg[yellow]%}%m%{$reset_color%} %{$fg_no_bold[magenta]%} ➜ %{$reset_color%} %{${fg[green]}%}%3~ $GIT_PROMPT_INFO%{${fg_bold[$CARETCOLOR]}%}»%{${reset_color}%} ' RPS1="${return_code}" diff --git a/themes/philips.zsh-theme b/themes/philips.zsh-theme index e7ea51a2..86c682e8 100644 --- a/themes/philips.zsh-theme +++ b/themes/philips.zsh-theme @@ -1,6 +1,6 @@ if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi -PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) ' +PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $GIT_PROMPT_INFO%(!.#.$) ' RPROMPT='[%*]' # git theming diff --git a/themes/pmcgee.zsh-theme b/themes/pmcgee.zsh-theme index e4e45c71..ded6c2fc 100644 --- a/themes/pmcgee.zsh-theme +++ b/themes/pmcgee.zsh-theme @@ -2,7 +2,7 @@ if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi PROMPT=' %{$fg[$NCOLOR]%}%B%n@%m%b%{$reset_color%} %{$fg[white]%}%B${PWD/#$HOME/~}%b%{$reset_color%} -$(git_prompt_info)%(!.#.$) ' +$GIT_PROMPT_INFO%(!.#.$) ' RPROMPT='[%*]' # git theming diff --git a/themes/re5et.zsh-theme b/themes/re5et.zsh-theme index 5bded76a..36b98a28 100644 --- a/themes/re5et.zsh-theme +++ b/themes/re5et.zsh-theme @@ -3,7 +3,7 @@ if [ "$(whoami)" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="magenta"; f local return_code="%(?..%{$fg_bold[red]%}:( %?%{$reset_color%})" PROMPT=' -%{$fg_bold[cyan]%}%n%{$reset_color%}%{$fg[yellow]%}@%{$reset_color%}%{$fg_bold[blue]%}%m%{$reset_color%}:%{${fg_bold[green]}%}%~%{$reset_color%}$(git_prompt_info) +%{$fg_bold[cyan]%}%n%{$reset_color%}%{$fg[yellow]%}@%{$reset_color%}%{$fg_bold[blue]%}%m%{$reset_color%}:%{${fg_bold[green]}%}%~%{$reset_color%}$GIT_PROMPT_INFO %{${fg[$CARETCOLOR]}%}%# %{${reset_color}%}' RPS1='${return_code} %D - %*' @@ -13,3 +13,33 @@ ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%} ±" ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ?" ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[red]%} ♥" + +git_prompt_info () +{ + if [ -z "$(git_prompt__git_dir)" ]; then + GIT_PROMPT_INFO='' + return + fi + + local prompt="" + git_prompt__branch + prompt=$GIT_PROMPT_BRANCH + + git_prompt__rebase_info + prompt="${prompt}$GIT_PROMPT_REBASE_INFO" + + if [[ -n "$prompt" ]]; then + git_prompt__dirty_state + if [[ "$GIT_PROMPT_DIRTY_STATE_ANY_DIRTY" = 'yes' ]]; then + prompt="$prompt%{$fg_bold[red]%}±" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_UNTRACKED" = 'yes' ]]; then + prompt="$prompt%{$fg[cyan]%}?" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_ANY_DIRTY" = 'no' ]]; then + prompt="$prompt%{$fg_bold[red]%}♥" + fi + + GIT_PROMPT_INFO="%{$fg_bold[magenta]%}^%{$reset_color%}%{$fg_bold[yellow]%}$prompt%{$reset_color%}" + fi +} diff --git a/themes/rgm.zsh-theme b/themes/rgm.zsh-theme index 9452a8b0..7a50c238 100644 --- a/themes/rgm.zsh-theme +++ b/themes/rgm.zsh-theme @@ -1,6 +1,6 @@ PROMPT=' %n@%m %{$fg[cyan]%}%~ -%? $(git_prompt_info)%{$fg_bold[blue]%}%% %{$reset_color%}' +%? $GIT_PROMPT_INFO%{$fg_bold[blue]%}%% %{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " diff --git a/themes/risto.zsh-theme b/themes/risto.zsh-theme index cb773a64..480899f1 100644 --- a/themes/risto.zsh-theme +++ b/themes/risto.zsh-theme @@ -1,6 +1,6 @@ # -*- sh -*- vim:set ft=sh ai et sw=4 sts=4: # It might be bash like, but I can't have my co-workers knowing I use zsh -PROMPT='%{$fg[green]%}%n@%m:%{$fg_bold[blue]%}%2~ $(git_prompt_info)%{$reset_color%}%(!.#.$) ' +PROMPT='%{$fg[green]%}%n@%m:%{$fg_bold[blue]%}%2~ $GIT_PROMPT_INFO%{$reset_color%}%(!.#.$) ' ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}‹" ZSH_THEME_GIT_PROMPT_SUFFIX="›%{$reset_color%}" diff --git a/themes/rixius.zsh-theme b/themes/rixius.zsh-theme index 7e7c9c63..78b54c6d 100644 --- a/themes/rixius.zsh-theme +++ b/themes/rixius.zsh-theme @@ -14,7 +14,7 @@ function prompt_char { RIXIUS_PRE="%{$bg[white]%}%{$fg[red]%}" PROMPT=' -%{$RIXIUS_PRE%}%n%{$reset_color%} in %{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(git_prompt_info) +%{$RIXIUS_PRE%}%n%{$reset_color%} in %{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$GIT_PROMPT_INFO $(prompt_char) ' RPROMPT='%{$RIXIUS_PRE%}%T%{$reset_color%}' diff --git a/themes/robbyrussell.zsh-theme b/themes/robbyrussell.zsh-theme index 7b524e82..4dcb7702 100644 --- a/themes/robbyrussell.zsh-theme +++ b/themes/robbyrussell.zsh-theme @@ -1,4 +1,4 @@ -PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' +PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$GIT_PROMPT_INFO%{$fg_bold[blue]%} % %{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" diff --git a/themes/simple.zsh-theme b/themes/simple.zsh-theme index a88d9d72..d345a9f9 100644 --- a/themes/simple.zsh-theme +++ b/themes/simple.zsh-theme @@ -1,4 +1,4 @@ -PROMPT='%{$fg[green]%}%~%{$fg_bold[blue]%}$(git_prompt_info)%{$reset_color%} ' +PROMPT='%{$fg[green]%}%~%{$fg_bold[blue]%}$GIT_PROMPT_INFO%{$reset_color%} ' ZSH_THEME_GIT_PROMPT_PREFIX="(" ZSH_THEME_GIT_PROMPT_SUFFIX=")" diff --git a/themes/skaro.zsh-theme b/themes/skaro.zsh-theme index 84b7b11b..9d8dd151 100644 --- a/themes/skaro.zsh-theme +++ b/themes/skaro.zsh-theme @@ -1,4 +1,4 @@ -PROMPT='%{$fg_bold[green]%}%h %{$fg[cyan]%}%2~ %{$fg_bold[blue]%}$(git_prompt_info) %{$reset_color%}» ' +PROMPT='%{$fg_bold[green]%}%h %{$fg[cyan]%}%2~ %{$fg_bold[blue]%}$GIT_PROMPT_INFO %{$reset_color%}» ' ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" diff --git a/themes/sorin.zsh-theme b/themes/sorin.zsh-theme index a63a9844..bd64866c 100644 --- a/themes/sorin.zsh-theme +++ b/themes/sorin.zsh-theme @@ -2,47 +2,72 @@ # FILE: sorin.zsh-theme # DESCRIPTION: oh-my-zsh theme file. # AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com) -# VERSION: 1.0.3 +# VERSION: 1.0.4 # SCREENSHOT: http://i.imgur.com/aipDQ.png # ------------------------------------------------------------------------------ -if [[ "$DISABLE_COLOR" != "true" ]]; then - MODE_INDICATOR="%{$fg_bold[red]%}❮%{$reset_color%}%{$fg[red]%}❮❮%{$reset_color%}" - local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%}" +if [[ "$DISABLE_COLORS" != "true" ]]; then + local R="%{$terminfo[sgr0]%}" + local MAGENTA="%{$fg[magenta]%}" + local YELLOW="%{$fg[yellow]%}" + local GREEN="%{$fg[green]%}" + local B_GREEN="%{$fg_bold[green]%}" + local BLUE="%{$fg[blue]%}" + local CYAN="%{$fg[cyan]%}" + local RED="%{$fg[red]%}" + local B_RED="%{$fg_bold[red]%}" +fi - PROMPT='%{$fg[cyan]%}%c$(git_prompt_info) %(!.%{$fg_bold[red]%}#.%{$fg_bold[green]%}❯)%{$reset_color%} ' +MODE_INDICATOR="$B_RED❮$R$RED❮❮$R" +local return_status="$RED%(?..⏎)$R" - ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[blue]%}git%{$reset_color%}:%{$fg[red]%}" - ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" - ZSH_THEME_GIT_PROMPT_DIRTY="" - ZSH_THEME_GIT_PROMPT_CLEAN="" +PROMPT='$CYAN%c$GIT_PROMPT_INFO %(!.$B_RED#.$B_GREEN❯)$R ' +RPROMPT='${return_status}$GIT_RPROMPT_INFO$R' - RPROMPT='${return_status}$(git_prompt_status)%{$reset_color%}' +git_prompt_info () +{ + if [ -z "$(git_prompt__git_dir)" ]; then + GIT_PROMPT_INFO='' + GIT_RPROMPT_INFO='' + return + fi - ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" - ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" - ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" - ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" - ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" - ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" -else - MODE_INDICATOR="❮❮❮" - local return_status="%(?::⏎)" + local branch='' - PROMPT='%c$(git_prompt_info) %(!.#.❯) ' + git_prompt__branch + branch="$GIT_PROMPT_BRANCH" - ZSH_THEME_GIT_PROMPT_PREFIX=" git:" - ZSH_THEME_GIT_PROMPT_SUFFIX="" - ZSH_THEME_GIT_PROMPT_DIRTY="" - ZSH_THEME_GIT_PROMPT_CLEAN="" + git_prompt__rebase_info + branch="${branch}$GIT_PROMPT_REBASE_INFO" - RPROMPT='${return_status}$(git_prompt_status)' + GIT_PROMPT_INFO=" ${BLUE}git$R:$RED${branch}$R" - ZSH_THEME_GIT_PROMPT_ADDED=" ✚" - ZSH_THEME_GIT_PROMPT_MODIFIED=" ✹" - ZSH_THEME_GIT_PROMPT_DELETED=" ✖" - ZSH_THEME_GIT_PROMPT_RENAMED=" ➜" - ZSH_THEME_GIT_PROMPT_UNMERGED=" ═" - ZSH_THEME_GIT_PROMPT_UNTRACKED=" ✭" -fi + local rprompt='' + git_prompt__dirty_state + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_ADDED" = 'yes' ]]; then + rprompt="$GREEN ✚" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_MODIFIED" = 'yes' ]]; then + rprompt="${rprompt}$BLUE ✹" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_MODIFIED" = 'yes' ]]; then + rprompt="${rprompt}$BLUE ✹" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_DELETED" = 'yes' ]]; then + rprompt="${rprompt}$RED ✖" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_DELETED" = 'yes' ]]; then + rprompt="${rprompt}$RED ✖" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_RENAMED" = 'yes' ]]; then + rprompt="${rprompt}$MAGENTA ➜" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_UNMERGED" = 'yes' ]]; then + rprompt="${rprompt}$YELLOW ═" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_UNTRACKED" = 'yes' ]]; then + rprompt="${rprompt}$CYAN ✭" + fi + GIT_RPROMPT_INFO=$rprompt +} diff --git a/themes/sporty_256.zsh-theme b/themes/sporty_256.zsh-theme index db0fc427..368c9613 100644 --- a/themes/sporty_256.zsh-theme +++ b/themes/sporty_256.zsh-theme @@ -3,7 +3,7 @@ # Preview - http://www.flickr.com/photos/adelcampo/4556482563/sizes/o/ # based on robbyrussell's shell but louder! -PROMPT='%{$fg_bold[blue]%}$(git_prompt_info) %F{208}%c%f +PROMPT='%{$fg_bold[blue]%}$GIT_PROMPT_INFO %F{208}%c%f %{$fg_bold[white]%}%# %{$reset_color%}' RPROMPT='%B%F{208}%n%f%{$fg_bold[white]%}@%F{039}%m%f%{$reset_color%}' diff --git a/themes/takashiyoshida.zsh-theme b/themes/takashiyoshida.zsh-theme index 419a8cf3..d2ab1890 100644 --- a/themes/takashiyoshida.zsh-theme +++ b/themes/takashiyoshida.zsh-theme @@ -10,8 +10,6 @@ PROMPT_BRACKET_END='%{$fg_bold[white]%}]' PROMPT_USER='%{$fg_bold[white]%}%n' PROMPT_SIGN='%{$reset_color%}%#' -GIT_PROMPT_INFO='$(git_prompt_info)' - # My current prompt looks like: # [host:current_dir] (git_prompt_info) # [username]% diff --git a/themes/theunraveler.zsh-theme b/themes/theunraveler.zsh-theme index a896970d..76508637 100644 --- a/themes/theunraveler.zsh-theme +++ b/themes/theunraveler.zsh-theme @@ -1,16 +1,49 @@ -# Comment - PROMPT='%{$fg[magenta]%}[%c] %{$reset_color%}' +RPROMPT='%{$fg[magenta]%}$GIT_PROMPT_INFO%{$reset_color%} $GIT_RPROMPT_INFO%{$reset_color%}' + +git_prompt_info () +{ + if [ -z "$(git_prompt__git_dir)" ]; then + GIT_PROMPT_INFO='' + GIT_RPROMPT_INFO='' + return + fi + + local prompt='' + + git_prompt__branch + prompt="$GIT_PROMPT_BRANCH" + + git_prompt__rebase_info + prompt="${prompt}$GIT_PROMPT_REBASE_INFO" -RPROMPT='%{$fg[magenta]%}$(git_prompt_info)%{$reset_color%} $(git_prompt_status)%{$reset_color%}' + GIT_PROMPT_INFO="$prompt" -ZSH_THEME_GIT_PROMPT_PREFIX="" -ZSH_THEME_GIT_PROMPT_SUFFIX="" -ZSH_THEME_GIT_PROMPT_DIRTY="" -ZSH_THEME_GIT_PROMPT_CLEAN="" -ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%} ✈" -ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%} ✭" -ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✗" -ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%} ➦" -ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%} ✂" -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%} ✱" + local rprompt='' + git_prompt__dirty_state + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_ADDED" = 'yes' ]]; then + rprompt="%{$fg[cyan]%} ✈" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_MODIFIED" = 'yes' ]]; then + rprompt="${rprompt}%{$fg[yellow]%} ✭" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_MODIFIED" = 'yes' ]]; then + rprompt="${rprompt}%{$fg[yellow]%} ✭" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_DELETED" = 'yes' ]]; then + rprompt="${rprompt}%{$fg[red]%} ✗" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_DELETED" = 'yes' ]]; then + rprompt="${rprompt}%{$fg[red]%} ✗" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_RENAMED" = 'yes' ]]; then + rprompt="${rprompt}%{$fg[blue]%} ➦" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_UNMERGED" = 'yes' ]]; then + rprompt="${rprompt}%{$fg[magenta]%} ✂" + fi + if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_UNTRACKED" = 'yes' ]]; then + rprompt="${rprompt}%{$fg[grey]%} ✱" + fi + GIT_RPROMPT_INFO=$rprompt +} diff --git a/themes/thomasjbradley.zsh-theme b/themes/thomasjbradley.zsh-theme index 857301d1..a2c6a25c 100644 --- a/themes/thomasjbradley.zsh-theme +++ b/themes/thomasjbradley.zsh-theme @@ -17,7 +17,7 @@ patches: %{\e[0m%}%b ' +%{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B] <$GIT_PROMPT_INFO>%{\e[0m%}%b ' PS2=$' \e[0;34m%}%B>%{\e[0m%}%b '