diff options
Diffstat (limited to 'themes')
64 files changed, 645 insertions, 517 deletions
diff --git a/themes/3den.zsh-theme b/themes/3den.zsh-theme index 1d2c7db7f..ae3a88659 100644 --- a/themes/3den.zsh-theme +++ b/themes/3den.zsh-theme @@ -1,4 +1,4 @@ -PROMPT=$'%{$fg[white]%}$(~/.rvm/bin/rvm-prompt) %{$fg_bold[cyan]%}%~%{$reset_color%}$(git_prompt_info) %{$fg[cyan]%}%D{[%I:%M:%S]}\ +PROMPT=$'%{$fg[white]%}$(ruby_prompt_info) %{$fg_bold[cyan]%}%~%{$reset_color%}$(git_prompt_info) %{$fg[cyan]%}%D{[%I:%M:%S]}\ %{$fg_bold[green]%}%n$%{$reset_color%} ' ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[white]%}(" diff --git a/themes/adben.zsh-theme b/themes/adben.zsh-theme index b9ac77d00..ebdec7c82 100644 --- a/themes/adben.zsh-theme +++ b/themes/adben.zsh-theme @@ -29,11 +29,13 @@ # # This theme's look and feel is based on the Aaron Toponce's zsh theme, more info: # # https://pthree.org/2008/11/23/727/ # # enjoy! + ########## COLOR ########### for COLOR in CYAN WHITE YELLOW MAGENTA BLACK BLUE RED DEFAULT GREEN GREY; do - eval PR_$COLOR='%{$fg[${(L)COLOR}]%}' - eval PR_BRIGHT_$COLOR='%{$fg_bold[${(L)COLOR}]%}' + eval PR_$COLOR='%{$fg[${(L)COLOR}]%}' + eval PR_BRIGHT_$COLOR='%{$fg_bold[${(L)COLOR}]%}' done + PR_RESET="%{$reset_color%}" RED_START="${PR_RESET}${PR_GREY}<${PR_RESET}${PR_RED}<${PR_BRIGHT_RED}<${PR_RESET} " RED_END="${PR_RESET}${PR_BRIGHT_RED}>${PR_RESET}${PR_RED}>${PR_GREY}>${PR_RESET} " @@ -44,14 +46,14 @@ DIVISION="${PR_RESET}${PR_RED} < ${PR_RESET}" VCS_DIRTY_COLOR="${PR_RESET}${PR_YELLOW}" VCS_CLEAN_COLOR="${PR_RESET}${PR_GREEN}" VCS_SUFIX_COLOR="${PR_RESET}${PR_RED}› ${PR_RESET}" -# ########## COLOR ########### -# ########## SVN ########### + +########## SVN ########### ZSH_THEME_SVN_PROMPT_PREFIX="${PR_RESET}${PR_RED}‹svn:" ZSH_THEME_SVN_PROMPT_SUFFIX="" ZSH_THEME_SVN_PROMPT_DIRTY="${VCS_DIRTY_COLOR} ✘${VCS_SUFIX_COLOR}" ZSH_THEME_SVN_PROMPT_CLEAN="${VCS_CLEAN_COLOR} ✔${VCS_SUFIX_COLOR}" -# ########## SVN ########### -# ########## GIT ########### + +########## GIT ########### ZSH_THEME_GIT_PROMPT_PREFIX="${PR_RESET}${PR_RED}‹git:" ZSH_THEME_GIT_PROMPT_SUFFIX="" ZSH_THEME_GIT_PROMPT_DIRTY="${VCS_DIRTY_COLOR} ✘${VCS_SUFIX_COLOR}" @@ -62,53 +64,63 @@ ZSH_THEME_GIT_PROMPT_DELETED="${PR_RESET}${PR_YELLOW} ✖${PR_RESET}" ZSH_THEME_GIT_PROMPT_RENAMED="${PR_RESET}${PR_YELLOW} ➜${PR_RESET}" ZSH_THEME_GIT_PROMPT_UNMERGED="${PR_RESET}${PR_YELLOW} ═${PR_RESET}" ZSH_THEME_GIT_PROMPT_UNTRACKED="${PR_RESET}${PR_YELLOW} ✭${PR_RESET}" -# ########## GIT ########### -function precmd { - #gets the fortune - ps1_fortune () { - #Choose from all databases, regardless of whether they are considered "offensive" - fortune -a - } - #obtains the tip - ps1_command_tip () { - wget -qO - http://www.commandlinefu.com/commands/random/plaintext | sed 1d | sed '/^$/d' - } - prompt_header () { - if [[ "true" == "$ENABLE_COMMAND_TIP" ]]; then - ps1_command_tip - else - ps1_fortune - fi - } - PROMPT_HEAD="${RED_START}${PR_YELLOW}$(prompt_header)${PR_RESET}" - # set a simple variable to show when in screen - if [[ -n "${WINDOW}" ]]; then - SCREEN="" + +# Get a fortune quote +ps1_fortune() { + (( ${+commands[fortune]} )) && fortune +} + +# Obtain a command tip +ps1_command_tip() { + { + if (( ${+commands[wget]} )); then + command wget -qO- https://www.commandlinefu.com/commands/random/plaintext + elif (( ${+commands[curl]} )); then + command curl -fsL https://www.commandlinefu.com/commands/random/plaintext fi + } | sed 1d | sed '/^$/d' } -# Context: user@directory or just directory -prompt_context () { - if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then - echo -n "${PR_RESET}${PR_RED}$USER@%m${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}" +function precmd_adben { + prompt_header() { + if [[ "$ENABLE_COMMAND_TIP" = true ]]; then + ps1_command_tip else - echo -n "${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}" + ps1_fortune fi + } + + PROMPT_HEAD="${RED_START}${PR_YELLOW}$(prompt_header)${PR_RESET}" + + # set a simple variable to show when in screen + if [[ -n "${WINDOW}" ]]; then + SCREEN="" + fi } -set_prompt () { - # required for the prompt - setopt prompt_subst - autoload zsh/terminfo +# Context: user@directory or just directory +prompt_context() { + if [[ "$USERNAME" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then + echo -n "${PR_RESET}${PR_RED}$USERNAME@%m${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}" + else + echo -n "${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}" + fi +} - # ######### PROMPT ######### - PROMPT='${PROMPT_HEAD} +########## SETUP ########### + +# Required for the prompt +setopt prompt_subst +autoload zsh/terminfo + +# Prompt +PROMPT='${PROMPT_HEAD} ${RED_START}$(prompt_context) ${GREEN_START_P1}' - RPROMPT='${PR_RESET}$(git_prompt_info)$(svn_prompt_info)${PR_YELLOW}%D{%R.%S %a %b %d %Y} ${GREEN_END}${PR_RESET}' - # Matching continuation prompt - PROMPT2='${GREEN_BASE_START}${PR_RESET} %_ ${GREEN_BASE_START}${PR_RESET} ' - # ######### PROMPT ######### -} +RPROMPT='${PR_RESET}$(git_prompt_info)$(svn_prompt_info)${PR_YELLOW}%D{%R.%S %a %b %d %Y} ${GREEN_END}${PR_RESET}' +# Matching continuation prompt +PROMPT2='${GREEN_BASE_START}${PR_RESET} %_ ${GREEN_BASE_START}${PR_RESET} ' -set_prompt +# Prompt head +autoload -Uz add-zsh-hook +add-zsh-hook precmd precmd_adben diff --git a/themes/af-magic.zsh-theme b/themes/af-magic.zsh-theme index 1c6d1732c..1d2af3458 100644 --- a/themes/af-magic.zsh-theme +++ b/themes/af-magic.zsh-theme @@ -2,32 +2,46 @@ # Repo: https://github.com/andyfleming/oh-my-zsh # Direct Link: https://github.com/andyfleming/oh-my-zsh/blob/master/themes/af-magic.zsh-theme -if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi -local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" -# primary prompt -PROMPT='$FG[237]------------------------------------------------------------%{$reset_color%} -$FG[032]%~\ -$(git_prompt_info) \ -$FG[105]%(!.#.»)%{$reset_color%} ' -PROMPT2='%{$fg[red]%}\ %{$reset_color%}' -RPS1='${return_code}' +# settings +typeset +H return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" +typeset +H my_gray="$FG[237]" +typeset +H my_orange="$FG[214]" +# separator dashes size +function afmagic_dashes { + local PYTHON_ENV="$VIRTUAL_ENV" + [[ -z "$PYTHON_ENV" ]] && PYTHON_ENV="$CONDA_DEFAULT_ENV" -# color vars -eval my_gray='$FG[237]' -eval my_orange='$FG[214]' + if [[ -n "$PYTHON_ENV" && "$PS1" = \(* ]]; then + echo $(( COLUMNS - ${#PYTHON_ENV} - 3 )) + else + echo $COLUMNS + fi +} + +# primary prompt +PS1='$FG[237]${(l.$(afmagic_dashes)..-.)}%{$reset_color%} +$FG[032]%~$(git_prompt_info)$(hg_prompt_info) $FG[105]%(!.#.»)%{$reset_color%} ' +PS2='%{$fg[red]%}\ %{$reset_color%}' +RPS1='${return_code}' # right prompt -if type "virtualenv_prompt_info" > /dev/null -then - RPROMPT='$(virtualenv_prompt_info)$my_gray%n@%m%{$reset_color%}%' -else - RPROMPT='$my_gray%n@%m%{$reset_color%}%' -fi +(( $+functions[virtualenv_prompt_info] )) && RPS1+='$(virtualenv_prompt_info)' +RPS1+=' $my_gray%n@%m%{$reset_color%}%' # git settings ZSH_THEME_GIT_PROMPT_PREFIX="$FG[075]($FG[078]" ZSH_THEME_GIT_PROMPT_CLEAN="" ZSH_THEME_GIT_PROMPT_DIRTY="$my_orange*%{$reset_color%}" ZSH_THEME_GIT_PROMPT_SUFFIX="$FG[075])%{$reset_color%}" + +# hg settings +ZSH_THEME_HG_PROMPT_PREFIX="$FG[075]($FG[078]" +ZSH_THEME_HG_PROMPT_CLEAN="" +ZSH_THEME_HG_PROMPT_DIRTY="$my_orange*%{$reset_color%}" +ZSH_THEME_HG_PROMPT_SUFFIX="$FG[075])%{$reset_color%}" + +# virtualenv settings +ZSH_THEME_VIRTUALENV_PREFIX=" $FG[075][" +ZSH_THEME_VIRTUALENV_SUFFIX="]%{$reset_color%}" diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index 0edb773aa..fe7ddbac6 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -88,7 +88,7 @@ prompt_end() { # Context: user@hostname (who am I and where am I) prompt_context() { - if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then + if [[ "$USERNAME" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then prompt_segment black default "%(!.%{%F{yellow}%}.)%n@%m" fi } @@ -106,7 +106,7 @@ prompt_git() { } local ref dirty mode repo_path - if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then + if [[ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]]; then repo_path=$(git rev-parse --git-dir 2>/dev/null) dirty=$(parse_git_dirty) ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git rev-parse --short HEAD 2> /dev/null)" @@ -131,7 +131,7 @@ prompt_git() { zstyle ':vcs_info:*' get-revision true zstyle ':vcs_info:*' check-for-changes true zstyle ':vcs_info:*' stagedstr '✚' - zstyle ':vcs_info:*' unstagedstr '●' + zstyle ':vcs_info:*' unstagedstr '±' zstyle ':vcs_info:*' formats ' %u%c' zstyle ':vcs_info:*' actionformats ' %u%c' vcs_info @@ -140,25 +140,30 @@ prompt_git() { } prompt_bzr() { - (( $+commands[bzr] )) || return - if (bzr status >/dev/null 2>&1); then - status_mod=`bzr status | head -n1 | grep "modified" | wc -m` - status_all=`bzr status | head -n1 | wc -m` - revision=`bzr log | head -n2 | tail -n1 | sed 's/^revno: //'` - if [[ $status_mod -gt 0 ]] ; then - prompt_segment yellow black - echo -n "bzr@"$revision "✚ " - else - if [[ $status_all -gt 0 ]] ; then - prompt_segment yellow black - echo -n "bzr@"$revision - - else - prompt_segment green black - echo -n "bzr@"$revision - fi - fi + (( $+commands[bzr] )) || return + + # Test if bzr repository in directory hierarchy + local dir="$PWD" + while [[ ! -d "$dir/.bzr" ]]; do + [[ "$dir" = "/" ]] && return + dir="${dir:h}" + done + + local bzr_status status_mod status_all revision + if bzr_status=$(bzr status 2>&1); then + status_mod=$(echo -n "$bzr_status" | head -n1 | grep "modified" | wc -m) + status_all=$(echo -n "$bzr_status" | head -n1 | wc -m) + revision=$(bzr log -r-1 --log-format line | cut -d: -f1) + if [[ $status_mod -gt 0 ]] ; then + prompt_segment yellow black "bzr@$revision ✚" + else + if [[ $status_all -gt 0 ]] ; then + prompt_segment yellow black "bzr@$revision" + else + prompt_segment green black "bzr@$revision" + fi fi + fi } prompt_hg() { @@ -224,11 +229,25 @@ prompt_status() { [[ -n "$symbols" ]] && prompt_segment black default "$symbols" } +#AWS Profile: +# - display current AWS_PROFILE name +# - displays yellow on red if profile name contains 'production' or +# ends in '-prod' +# - displays black on green otherwise +prompt_aws() { + [[ -z "$AWS_PROFILE" || "$SHOW_AWS_PROMPT" = false ]] && return + case "$AWS_PROFILE" in + *-prod|*production*) prompt_segment red yellow "AWS: $AWS_PROFILE" ;; + *) prompt_segment green black "AWS: $AWS_PROFILE" ;; + esac +} + ## Main prompt build_prompt() { RETVAL=$? prompt_status prompt_virtualenv + prompt_aws prompt_context prompt_dir prompt_git diff --git a/themes/alanpeabody.zsh-theme b/themes/alanpeabody.zsh-theme index 4a1b1b386..1de90e57b 100644 --- a/themes/alanpeabody.zsh-theme +++ b/themes/alanpeabody.zsh-theme @@ -1,17 +1,10 @@ local user='%{$fg[magenta]%}%n@%{$fg[magenta]%}%m%{$reset_color%}' local pwd='%{$fg[blue]%}%~%{$reset_color%}' -local rvm='' -if which rvm-prompt &> /dev/null; then - rvm='%{$fg[green]%}‹$(rvm-prompt i v g)›%{$reset_color%}' -else - if which rbenv &> /dev/null; then - rvm='%{$fg[green]%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}' - fi -fi local return_code='%(?..%{$fg[red]%}%? ↵%{$reset_color%})' local git_branch='$(git_prompt_status)%{$reset_color%}$(git_prompt_info)%{$reset_color%}' +ZSH_THEME_RVM_PROMPT_OPTIONS="i v g" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY="" @@ -24,5 +17,8 @@ ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" +ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[green]%}‹" +ZSH_THEME_RUBY_PROMPT_SUFFIX="›%{$reset_color%}" + PROMPT="${user} ${pwd}$ " -RPROMPT="${return_code} ${git_branch} ${rvm}" +RPROMPT="${return_code} ${git_branch} \$(ruby_prompt_info)" diff --git a/themes/amuse.zsh-theme b/themes/amuse.zsh-theme index d3f15ace5..3f7ec0bc5 100644 --- a/themes/amuse.zsh-theme +++ b/themes/amuse.zsh-theme @@ -1,17 +1,5 @@ # vim:ft=zsh ts=2 sw=2 sts=2 -rvm_current() { - rvm current 2>/dev/null -} - -rbenv_version() { - rbenv version 2>/dev/null | awk '{print $1}' -} - -PROMPT=' -%{$fg_bold[green]%}%~%{$reset_color%}$(git_prompt_info) ⌚ %{$fg_bold[red]%}%*%{$reset_color%} -$ ' - # Must use Powerline font, for \uE0A0 to render. ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}\uE0A0 " ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" @@ -19,11 +7,12 @@ ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}!" ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?" ZSH_THEME_GIT_PROMPT_CLEAN="" -if [ -e ~/.rvm/bin/rvm-prompt ]; then - RPROMPT='%{$fg_bold[red]%}‹$(rvm_current)›%{$reset_color%}' -else - if which rbenv &> /dev/null; then - RPROMPT='%{$fg_bold[red]%}$(rbenv_version)%{$reset_color%}' - fi -fi +ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg_bold[red]%}‹" +ZSH_THEME_RUBY_PROMPT_SUFFIX="›%{$reset_color%}" + +PROMPT=' +%{$fg_bold[green]%}%~%{$reset_color%}$(git_prompt_info) ⌚ %{$fg_bold[red]%}%*%{$reset_color%} +$ ' + +RPROMPT='$(ruby_prompt_info)' diff --git a/themes/arrow.zsh-theme b/themes/arrow.zsh-theme index a3e77d65d..76c031fd2 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]%} $(git_prompt_info)%{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX="git:" ZSH_THEME_GIT_PROMPT_SUFFIX="" diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme index aec14e4a6..1e20d8f9f 100644 --- a/themes/avit.zsh-theme +++ b/themes/avit.zsh-theme @@ -1,30 +1,23 @@ # AVIT ZSH Theme -PROMPT=' -$(_user_host)${_current_dir} $(git_prompt_info) $(_ruby_version) -%{$fg[$CARETCOLOR]%}▶%{$resetcolor%} ' - -PROMPT2='%{$fg[$CARETCOLOR]%}◀%{$reset_color%} ' +# settings +typeset +H _current_dir="%{$fg_bold[blue]%}%3~%{$reset_color%} " +typeset +H _return_status="%{$fg_bold[red]%}%(?..⍉)%{$reset_color%}" +typeset +H _hist_no="%{$fg[grey]%}%h%{$reset_color%}" -RPROMPT='$(_vi_status)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}' +PROMPT=' +$(_user_host)${_current_dir} $(git_prompt_info) $(ruby_prompt_info) +%{%(!.${fg[red]}.${fg[white]})%}▶%{$reset_color%} ' -local _current_dir="%{$fg_bold[blue]%}%3~%{$reset_color%} " -local _return_status="%{$fg_bold[red]%}%(?..⍉)%{$reset_color%}" -local _hist_no="%{$fg[grey]%}%h%{$reset_color%}" +PROMPT2='%{%(!.${fg[red]}.${fg[white]})%}◀%{$reset_color%} ' -function _current_dir() { - local _max_pwd_length="65" - if [[ $(echo -n $PWD | wc -c) -gt ${_max_pwd_length} ]]; then - echo "%{$fg_bold[blue]%}%-2~ ... %3~%{$reset_color%} " - else - echo "%{$fg_bold[blue]%}%~%{$reset_color%} " - fi -} +RPROMPT='$(vi_mode_prompt_info)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}' function _user_host() { + local me if [[ -n $SSH_CONNECTION ]]; then me="%n@%m" - elif [[ $LOGNAME != $USER ]]; then + elif [[ $LOGNAME != $USERNAME ]]; then me="%n" fi if [[ -n $me ]]; then @@ -32,61 +25,41 @@ function _user_host() { fi } -function _vi_status() { - if {echo $fpath | grep -q "plugins/vi-mode"}; then - echo "$(vi_mode_prompt_info)" - fi -} - -function _ruby_version() { - if {echo $fpath | grep -q "plugins/rvm"}; then - echo "%{$fg[grey]%}$(rvm_prompt_info)%{$reset_color%}" - elif {echo $fpath | grep -q "plugins/rbenv"}; then - echo "%{$fg[grey]%}$(rbenv_prompt_info)%{$reset_color%}" - fi -} - # 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() { -# Only proceed if there is actually a commit. + local last_commit now seconds_since_last_commit + local minutes hours days years commit_age + # Only proceed if there is actually a commit. if last_commit=$(git log --pretty=format:'%at' -1 2> /dev/null); then now=$(date +%s) seconds_since_last_commit=$((now-last_commit)) # Totals minutes=$((seconds_since_last_commit / 60)) - hours=$((seconds_since_last_commit/3600)) - - # Sub-hours and sub-minutes - days=$((seconds_since_last_commit / 86400)) - sub_hours=$((hours % 24)) - sub_minutes=$((minutes % 60)) - - if [ $hours -ge 24 ]; then - commit_age="${days}d" - elif [ $minutes -gt 60 ]; then - commit_age="${sub_hours}h${sub_minutes}m" + hours=$((minutes / 60)) + days=$((hours / 24)) + years=$((days / 365)) + + if [[ $years -gt 0 ]]; then + commit_age="${years}y$((days % 365 ))d" + elif [[ $days -gt 0 ]]; then + commit_age="${days}d$((hours % 24))h" + elif [[ $hours -gt 0 ]]; then + commit_age+="${hours}h$(( minutes % 60 ))m" else commit_age="${minutes}m" fi - color=$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL - echo "$color$commit_age%{$reset_color%}" + echo "${ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL}${commit_age}%{$reset_color%}" fi } -if [[ $USER == "root" ]]; then - CARETCOLOR="red" -else - CARETCOLOR="white" -fi - MODE_INDICATOR="%{$fg_bold[yellow]%}❮%{$reset_color%}%{$fg[yellow]%}❮❮%{$reset_color%}" +# Git prompt settings ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" - ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}✗%{$reset_color%}" ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}✔%{$reset_color%}" ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%}✚ " @@ -96,6 +69,10 @@ ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}▴ " ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[cyan]%}§ " ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[white]%}◒ " +# Ruby prompt settings +ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[grey]%}" +ZSH_THEME_RUBY_PROMPT_SUFFIX="%{$reset_color%}" + # Colors vary depending on time lapsed. ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}" ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}" diff --git a/themes/awesomepanda.zsh-theme b/themes/awesomepanda.zsh-theme index 1c5d06b2d..85036e4ac 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. local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)" -PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}$(svn_prompt_info)%{$reset_color%}' +PROMPT='${ret_status}%{$fg_bold[green]%} %{$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 675483996..cdae68d6c 100644 --- a/themes/bira.zsh-theme +++ b/themes/bira.zsh-theme @@ -1,30 +1,32 @@ # ZSH Theme - Preview: https://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" - if [[ $UID -eq 0 ]]; then - local user_host='%{$terminfo[bold]$fg[red]%}%n@%m%{$reset_color%}' + local user_host='%{$terminfo[bold]$fg[red]%}%n@%m %{$reset_color%}' local user_symbol='#' else - local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}' + local user_host='%{$terminfo[bold]$fg[green]%}%n@%m %{$reset_color%}' local user_symbol='$' fi -local current_dir='%{$terminfo[bold]$fg[blue]%}%~%{$reset_color%}' -local rvm_ruby='' -if which rvm-prompt &> /dev/null; then - rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}' -else - if which rbenv &> /dev/null; then - rvm_ruby='%{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}' - fi -fi -local git_branch='$(git_prompt_info)%{$reset_color%}' +local current_dir='%{$terminfo[bold]$fg[blue]%}%~ %{$reset_color%}' +local git_branch='$(git_prompt_info)' +local rvm_ruby='$(ruby_prompt_info)' +local venv_prompt='$(virtualenv_prompt_info)' -PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch} +ZSH_THEME_RVM_PROMPT_OPTIONS="i v g" + +PROMPT="╭─${user_host}${current_dir}${rvm_ruby}${git_branch}${venv_prompt} ╰─%B${user_symbol}%b " -RPS1="%B${return_code}%b" +RPROMPT="%B${return_code}%b" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" +ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[red]%}‹" +ZSH_THEME_RUBY_PROMPT_SUFFIX="› %{$reset_color%}" + +ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX="%{$fg[green]%}‹" +ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX="› %{$reset_color%}" +ZSH_THEME_VIRTUALENV_PREFIX=$ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX +ZSH_THEME_VIRTUALENV_SUFFIX=$ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX diff --git a/themes/candy-kingdom.zsh-theme b/themes/candy-kingdom.zsh-theme index 30ce785c0..ad03cc320 100644 --- a/themes/candy-kingdom.zsh-theme +++ b/themes/candy-kingdom.zsh-theme @@ -1,16 +1,14 @@ -# neuralsanwich.zsh-theme - -if [ "x$OH_MY_ZSH_HG" = "x" ]; then - OH_MY_ZSH_HG="hg" -fi - -function hg_prompt_info { - $OH_MY_ZSH_HG prompt --angle-brackets "\ +if ! hg prompt 2>/dev/null; then + function hg_prompt_info { } +else + function hg_prompt_info { + hg prompt --angle-brackets "\ < on %{$fg[magenta]%}<branch>%{$reset_color%}>\ < at %{$fg[yellow]%}<tags|%{$reset_color%}, %{$fg[yellow]%}>%{$reset_color%}>\ %{$fg[green]%}<status|modified|unknown><update>%{$reset_color%}< patches: <patches|join( → )|pre_applied(%{$fg[yellow]%})|post_applied(%{$reset_color%})|pre_unapplied(%{$fg_bold[black]%})|post_unapplied(%{$reset_color%})>>" 2>/dev/null -} + } +fi function box_name { [ -f ~/.box-name ] && cat ~/.box-name || echo ${SHORT_HOST:-$HOST} @@ -26,5 +24,9 @@ ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[red]%}?" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[orange]%}!" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%})" -local return_status="%{$fg[red]%}%(?..✘)%{$reset_color%}" -RPROMPT='${return_status}$(battery_time_remaining) $(battery_pct_prompt)%{$reset_color%}' +RPROMPT='%{$fg[red]%}%(?..✘)%{$reset_color%}' + +# Add battery status if the battery plugin is enabled +if (( $+functions[battery_pct_prompt] )); then + RPROMPT+='$(battery_time_remaining) $(battery_pct_prompt)%{$reset_color%}' +fi diff --git a/themes/cloud.zsh-theme b/themes/cloud.zsh-theme index 59a3472b6..e26f786e1 100644 --- a/themes/cloud.zsh-theme +++ b/themes/cloud.zsh-theme @@ -2,7 +2,7 @@ if [[ -z $ZSH_THEME_CLOUD_PREFIX ]]; then ZSH_THEME_CLOUD_PREFIX='☁' fi -PROMPT='%{$fg_bold[cyan]%}$ZSH_THEME_CLOUD_PREFIX %{$fg_bold[green]%}%p %{$fg[green]%}%c %{$fg_bold[cyan]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' +PROMPT='%{$fg_bold[cyan]%}$ZSH_THEME_CLOUD_PREFIX %{$fg_bold[green]%} %{$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/crcandy.zsh-theme b/themes/crcandy.zsh-theme index 0a63c1245..5b9cd42f8 100644 --- a/themes/crcandy.zsh-theme +++ b/themes/crcandy.zsh-theme @@ -1,5 +1,5 @@ PROMPT=$' -%{$fg_bold[green]%}%n@%m %{$fg[blue]%}%D{[%I:%M:%S]} %{$reset_color%}%{$fg[white]%}[%~]%{$reset_color%} $(git_prompt_info)\ +%{$fg_bold[green]%}%n@%m %{$fg[blue]%}%D{[%H:%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/crunch.zsh-theme b/themes/crunch.zsh-theme index 2fc066381..8278661ab 100644 --- a/themes/crunch.zsh-theme +++ b/themes/crunch.zsh-theme @@ -29,13 +29,9 @@ ZSH_THEME_GIT_PROMPT_DIRTY=" $CRUNCH_GIT_DIRTY_COLOR✗" # Our elements: CRUNCH_TIME_="$CRUNCH_BRACKET_COLOR{$CRUNCH_TIME_COLOR%T$CRUNCH_BRACKET_COLOR}%{$reset_color%}" -if [ -e ~/.rvm/bin/rvm-prompt ]; then - CRUNCH_RVM_="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR\${\$(~/.rvm/bin/rvm-prompt i v g)#ruby-}$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}" -else - if which rbenv &> /dev/null; then - CRUNCH_RVM_="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR\${\$(rbenv version | sed -e 's/ (set.*$//' -e 's/^ruby-//')}$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}" - fi -fi +ZSH_THEME_RUBY_PROMPT_PREFIX="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR" +ZSH_THEME_RUBY_PROMPT_SUFFIX="$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}" +CRUNCH_RVM_='$(ruby_prompt_info)' CRUNCH_DIR_="$CRUNCH_DIR_COLOR%~\$(git_prompt_info) " CRUNCH_PROMPT="$CRUNCH_BRACKET_COLOR➭ " diff --git a/themes/dallas.zsh-theme b/themes/dallas.zsh-theme index e9e86177b..d6c417fc3 100644 --- a/themes/dallas.zsh-theme +++ b/themes/dallas.zsh-theme @@ -2,14 +2,6 @@ # Grab the current date (%D) and time (%T) wrapped in {}: {%D %T} DALLAS_CURRENT_TIME_="%{$fg[white]%}{%{$fg[yellow]%}%D %T%{$fg[white]%}}%{$reset_color%}" -# Grab the current version of ruby in use (via RVM): [ruby-1.8.7] -if [ -e ~/.rvm/bin/rvm-prompt ]; then - DALLAS_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[magenta]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}" -else - if which rbenv &> /dev/null; then - DALLAS_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[magenta]%}\$(rbenv version | sed -e 's/ (set.*$//')%{$fg[white]%}]%{$reset_color%}" - fi -fi # Grab the current machine name: muscato DALLAS_CURRENT_MACH_="%{$fg[green]%}%m%{$fg[white]%}:%{$reset_color%}" # Grab the current filepath, use shortcuts: ~/Desktop @@ -28,5 +20,8 @@ ZSH_THEME_GIT_PROMPT_CLEAN="" # Add 3 cyan ✗s if this branch is diiirrrty! Dirty branch! ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[cyan]%}✗✗✗" +ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[white]%}[%{$fg[magenta]%}" +ZSH_THEME_RUBY_PROMPT_SUFFIX="%{$fg[white]%}]%{$reset_color%}" + # Put it all together! -PROMPT="$DALLAS_CURRENT_TIME_$DALLAS_CURRENT_RUBY_$DALLAS_CURRENT_MACH_$DALLAS_CURRENT_LOCA_ $DALLAS_CURRENT_USER_$DALLAS_PROMPT_CHAR_ " +PROMPT="$DALLAS_CURRENT_TIME_\$(ruby_prompt_info)$DALLAS_CURRENT_MACH_$DALLAS_CURRENT_LOCA_ $DALLAS_CURRENT_USER_$DALLAS_PROMPT_CHAR_ " diff --git a/themes/dst.zsh-theme b/themes/dst.zsh-theme index 3e2539d57..6b2f8767d 100644 --- a/themes/dst.zsh-theme +++ b/themes/dst.zsh-theme @@ -11,6 +11,6 @@ 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) -%_ $(prompt_char) ' +$(prompt_char) ' RPROMPT='%{$fg[green]%}[%*]%{$reset_color%}' diff --git a/themes/edvardm.zsh-theme b/themes/edvardm.zsh-theme index f9ca1a9e2..d41dd4434 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]%} %{$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/essembeh.zsh-theme b/themes/essembeh.zsh-theme index 939bb7a4c..f34f36f8a 100644 --- a/themes/essembeh.zsh-theme +++ b/themes/essembeh.zsh-theme @@ -1,24 +1,14 @@ -# Theme with full path names and hostname -# Handy if you work on different servers all the time; - -local return_code="%(?..%{$fg_bold[red]%}%? ↵%{$reset_color%})" - -function my_git_prompt_info() { - ref=$(git symbolic-ref HEAD 2> /dev/null) || return - GIT_STATUS=$(git_prompt_status) - [[ -n $GIT_STATUS ]] && GIT_STATUS=" $GIT_STATUS" - echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$GIT_STATUS$ZSH_THEME_GIT_PROMPT_SUFFIX" -} - -# Colored prompt -ZSH_THEME_COLOR_USER="green" -ZSH_THEME_COLOR_HOST="green" -ZSH_THEME_COLOR_PWD="yellow" -test -n "$SSH_CONNECTION" && ZSH_THEME_COLOR_USER="red" && ZSH_THEME_COLOR_HOST="red" -test `id -u` = 0 && ZSH_THEME_COLOR_USER="magenta" && ZSH_THEME_COLOR_HOST="magenta" -PROMPT='%{$fg_bold[$ZSH_THEME_COLOR_USER]%}%n@%{$fg_bold[$ZSH_THEME_COLOR_HOST]%}%M%{$reset_color%}:%{$fg_bold[$ZSH_THEME_COLOR_PWD]%}%~%{$reset_color%} $(my_git_prompt_info)%(!.#.$) ' -RPS1="${return_code}" +# My custom theme: +# - single line +# - quite simple by default: user@host:$PWD +# - green for local shell as non root +# - red for ssh shell as non root +# - magenta for root sessions +# - prefix with remote address for ssh shells +# - prefix to detect docker containers or chroot +# - git plugin to display current branch and status +# git plugin ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[cyan]%}(" ZSH_THEME_GIT_PROMPT_SUFFIX=") %{$reset_color%}" ZSH_THEME_GIT_PROMPT_UNTRACKED="%%" @@ -28,3 +18,33 @@ ZSH_THEME_GIT_PROMPT_RENAMED="~" ZSH_THEME_GIT_PROMPT_DELETED="!" ZSH_THEME_GIT_PROMPT_UNMERGED="?" +function zsh_essembeh_gitstatus { + ref=$(git symbolic-ref HEAD 2> /dev/null) || return + GIT_STATUS=$(git_prompt_status) + if [[ -n $GIT_STATUS ]]; then + GIT_STATUS=" $GIT_STATUS" + fi + echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$GIT_STATUS$ZSH_THEME_GIT_PROMPT_SUFFIX" +} + +# by default, use green for user@host and no prefix +local ZSH_ESSEMBEH_COLOR="green" +local ZSH_ESSEMBEH_PREFIX="" +if [[ -n "$SSH_CONNECTION" ]]; then + # display the source address if connected via ssh + ZSH_ESSEMBEH_PREFIX="%{$fg[yellow]%}[$(echo $SSH_CONNECTION | awk '{print $1}')]%{$reset_color%} " + # use red color to highlight a remote connection + ZSH_ESSEMBEH_COLOR="red" +elif [[ -r /etc/debian_chroot ]]; then + # prefix prompt in case of chroot + ZSH_ESSEMBEH_PREFIX="%{$fg[yellow]%}[chroot:$(cat /etc/debian_chroot)]%{$reset_color%} " +elif [[ -r /.dockerenv ]]; then + # also prefix prompt inside a docker contrainer + ZSH_ESSEMBEH_PREFIX="%{$fg[yellow]%}[docker]%{$reset_color%} " +fi +if [[ $UID = 0 ]]; then + # always use magenta for root sessions, even in ssh + ZSH_ESSEMBEH_COLOR="magenta" +fi +PROMPT='${ZSH_ESSEMBEH_PREFIX}%{$fg[$ZSH_ESSEMBEH_COLOR]%}%n@%M%{$reset_color%}:%{%B$fg[yellow]%}%~%{$reset_color%b%} $(zsh_essembeh_gitstatus)%(!.#.$) ' +RPROMPT="%(?..%{$fg[red]%}%?%{$reset_color%})" diff --git a/themes/evan.zsh-theme b/themes/evan.zsh-theme index 5ef1f40dd..02ca22d4c 100644 --- a/themes/evan.zsh-theme +++ b/themes/evan.zsh-theme @@ -1,2 +1,2 @@ -# Evan describes this sexy prompt as: "a skinny, topless prompt" -PROMPT='%m :: %2~ %B»%b '
\ No newline at end of file +# Evan's minimal prompt +PROMPT='%m :: %2~ %B»%b ' diff --git a/themes/fino-time.zsh-theme b/themes/fino-time.zsh-theme index 9caebc69e..57c47db02 100644 --- a/themes/fino-time.zsh-theme +++ b/themes/fino-time.zsh-theme @@ -25,18 +25,12 @@ function box_name { } -rvm_ruby='' -if type rvm-prompt &>/dev/null; then - rvm_ruby='using%{$FG[243]%}‹$(rvm-prompt i v g)›%{$reset_color%}' -fi - -local git_info='$(git_prompt_info)' - - -PROMPT="╭─%{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}at%{$reset_color%} %{$FG[033]%}$(box_name)%{$reset_color%} %{$FG[239]%}in%{$reset_color%} %{$terminfo[bold]$FG[226]%}%~%{$reset_color%}${git_info} %{$FG[239]%}${rvm_ruby} %D - %* -╰─$(virtualenv_info)$(prompt_char) " +PROMPT="╭─%{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}at%{$reset_color%} %{$FG[033]%}$(box_name)%{$reset_color%} %{$FG[239]%}in%{$reset_color%} %{$terminfo[bold]$FG[226]%}%~%{$reset_color%}\$(git_prompt_info)\$(ruby_prompt_info) %D - %* +╰─\$(virtualenv_info)\$(prompt_char) " ZSH_THEME_GIT_PROMPT_PREFIX=" %{$FG[239]%}on%{$reset_color%} %{$fg[255]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY="%{$FG[202]%}✘✘✘" ZSH_THEME_GIT_PROMPT_CLEAN="%{$FG[040]%}✔" +ZSH_THEME_RUBY_PROMPT_PREFIX=" %{$FG[239]%}using%{$FG[243]%} ‹" +ZSH_THEME_RUBY_PROMPT_SUFFIX="›%{$reset_color%}" diff --git a/themes/fino.zsh-theme b/themes/fino.zsh-theme index 28d6cc2ec..2523c1776 100644 --- a/themes/fino.zsh-theme +++ b/themes/fino.zsh-theme @@ -11,32 +11,35 @@ # # Also borrowing from http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/ +function virtualenv_prompt_info { + [[ -n ${VIRTUAL_ENV} ]] || return + echo "${ZSH_THEME_VIRTUALENV_PREFIX:=[}${VIRTUAL_ENV:t}${ZSH_THEME_VIRTUALENV_SUFFIX:=]}" +} + function prompt_char { - git branch >/dev/null 2>/dev/null && echo "±" && return - echo '○' + command git branch &>/dev/null && echo "±" || echo '○' } function box_name { - [ -f ~/.box-name ] && cat ~/.box-name || echo ${SHORT_HOST:-$HOST} + [ -f ~/.box-name ] && cat ~/.box-name || echo ${SHORT_HOST:-$HOST} } -local ruby_env='' -if which rvm-prompt &> /dev/null; then - ruby_env='using%{$FG[243]%} ‹$(rvm-prompt i v g)›%{$reset_color%}' -else - if which rbenv &> /dev/null; then - ruby_env='using%{$FG[243]%} ‹$(rbenv version-name)›%{$reset_color%}' - fi -fi - +local ruby_env='$(ruby_prompt_info)' local git_info='$(git_prompt_info)' +local virtualenv_info='$(virtualenv_prompt_info)' local prompt_char='$(prompt_char)' - -PROMPT="╭─%{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}at%{$reset_color%} %{$FG[033]%}$(box_name)%{$reset_color%} %{$FG[239]%}in%{$reset_color%} %{$terminfo[bold]$FG[226]%}%~%{$reset_color%}${git_info} %{$FG[239]%}${ruby_env} +PROMPT="╭─${FG[040]}%n ${FG[239]}at ${FG[033]}$(box_name) ${FG[239]}in %B${FG[226]}%~%b${git_info}${ruby_env}${virtualenv_info} ╰─${prompt_char}%{$reset_color%} " -ZSH_THEME_GIT_PROMPT_PREFIX=" %{$FG[239]%}on%{$reset_color%} %{$fg[255]%}" +ZSH_THEME_GIT_PROMPT_PREFIX=" ${FG[239]}on%{$reset_color%} ${FG[255]}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$FG[202]%}✘✘✘" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$FG[040]%}✔" +ZSH_THEME_GIT_PROMPT_DIRTY="${FG[202]}✘✘✘" +ZSH_THEME_GIT_PROMPT_CLEAN="${FG[040]}✔" + +ZSH_THEME_RUBY_PROMPT_PREFIX=" ${FG[239]}using${FG[243]} ‹" +ZSH_THEME_RUBY_PROMPT_SUFFIX="›%{$reset_color%}" + +export VIRTUAL_ENV_DISABLE_PROMPT=1 +ZSH_THEME_VIRTUALENV_PREFIX=" ${FG[239]}using${FG[243]} «" +ZSH_THEME_VIRTUALENV_SUFFIX="»%{$reset_color%}" diff --git a/themes/fishy.zsh-theme b/themes/fishy.zsh-theme index 83bd455b5..2b8d559e5 100644 --- a/themes/fishy.zsh-theme +++ b/themes/fishy.zsh-theme @@ -1,12 +1,18 @@ # ZSH Theme emulating the Fish shell's default prompt. _fishy_collapsed_wd() { - echo $(pwd | perl -pe ' - BEGIN { - binmode STDIN, ":encoding(UTF-8)"; - binmode STDOUT, ":encoding(UTF-8)"; - }; s|^$ENV{HOME}|~|g; s|/([^/.])[^/]*(?=/)|/$1|g; s|/\.([^/])[^/]*(?=/)|/.$1|g -') + local i pwd + pwd=("${(s:/:)PWD/#$HOME/~}") + if (( $#pwd > 1 )); then + for i in {1..$(($#pwd-1))}; do + if [[ "$pwd[$i]" = .* ]]; then + pwd[$i]="${${pwd[$i]}[1,2]}" + else + pwd[$i]="${${pwd[$i]}[1]}" + fi + done + fi + echo "${(j:/:)pwd}" } local user_color='green'; [ $UID -eq 0 ] && user_color='red' @@ -14,7 +20,7 @@ PROMPT='%n@%m %{$fg[$user_color]%}$(_fishy_collapsed_wd)%{$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="${RPROMPT}"'${return_status}$(git_prompt_info)$(git_prompt_status)%{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX=" " ZSH_THEME_GIT_PROMPT_SUFFIX="" diff --git a/themes/flazz.zsh-theme b/themes/flazz.zsh-theme index c0a7fb5d0..e21b52ef5 100644 --- a/themes/flazz.zsh-theme +++ b/themes/flazz.zsh-theme @@ -1,4 +1,4 @@ -if [ "$USER" = "root" ] +if [ "$USERNAME" = "root" ] then CARETCOLOR="red" else CARETCOLOR="blue" fi diff --git a/themes/frontcube.zsh-theme b/themes/frontcube.zsh-theme index 539e744f8..f9488d0ac 100644 --- a/themes/frontcube.zsh-theme +++ b/themes/frontcube.zsh-theme @@ -1,12 +1,13 @@ -local rvm="%{$fg[green]%}[$(rvm-prompt i v g)]%{$reset_color%}" PROMPT=' %{$fg_bold[gray]%}%~%{$fg_bold[blue]%}%{$fg_bold[blue]%} % %{$reset_color%} %{$fg[green]%}➞ %{$reset_color%' -RPROMPT='$(git_prompt_info) ${rvm}' +RPROMPT='$(git_prompt_info) $(ruby_prompt_info)' ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}[git:" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}] %{$fg[red]%}✖ %{$reset_color%}" ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}] %{$fg[green]%}✔%{$reset_color%}" +ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[green]%}[" +ZSH_THEME_RUBY_PROMPT_SUFFIX="]%{$reset_color%}" diff --git a/themes/fwalch.zsh-theme b/themes/fwalch.zsh-theme index 24edf55c0..33f851c9d 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]%} %{$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 252566f06..47b057fa3 100644 --- a/themes/gallifrey.zsh-theme +++ b/themes/gallifrey.zsh-theme @@ -1,8 +1,11 @@ -# ZSH Theme - Preview: https://flic.kr/p/ZFvivf -local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" +# ZSH Theme - Preview: https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#gallifrey +return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" +host_color="%(!.%{$fg[red]%}.%{$fg[green]%})" -PROMPT='%{$fg[green]%}%m%{$reset_color%} %2~ $(git_prompt_info)%{$reset_color%}%B»%b ' +PROMPT="${host_color}%m%{$reset_color%} %2~ \$(git_prompt_info)%{$reset_color%}%B»%b " RPS1="${return_code}" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" + +unset return_code host_color diff --git a/themes/gallois.zsh-theme b/themes/gallois.zsh-theme index 515325e38..bb97bfb17 100644 --- a/themes/gallois.zsh-theme +++ b/themes/gallois.zsh-theme @@ -1,23 +1,24 @@ # Depends on the git plugin for work_in_progress() +(( $+functions[work_in_progress] )) || work_in_progress() {} 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="" -#Customized git status, oh-my-zsh currently does not allow render dirty status before branch +# Customized git status, oh-my-zsh currently does not allow render dirty status before branch git_custom_status() { - local cb=$(git_current_branch) - if [ -n "$cb" ]; then - echo "$(parse_git_dirty)%{$fg_bold[yellow]%}$(work_in_progress)%{$reset_color%}$ZSH_THEME_GIT_PROMPT_PREFIX$(git_current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX" - fi + local branch=$(git_current_branch) + [[ -n "$branch" ]] || return 0 + echo "$(parse_git_dirty)\ +%{${fg_bold[yellow]}%}$(work_in_progress)%{$reset_color%}\ +${ZSH_THEME_GIT_PROMPT_PREFIX}${branch}${ZSH_THEME_GIT_PROMPT_SUFFIX}" } # RVM component of prompt -ZSH_THEME_RVM_PROMPT_PREFIX="%{$fg[red]%}[" -ZSH_THEME_RVM_PROMPT_SUFFIX="]%{$reset_color%}" +ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[red]%}[" +ZSH_THEME_RUBY_PROMPT_SUFFIX="]%{$reset_color%}" # Combine it all into a final right-side prompt -RPS1='$(git_custom_status)$(ruby_prompt_info) $EPS1' - +RPS1="\$(git_custom_status)\$(ruby_prompt_info)${RPS1:+ $RPS1}" PROMPT='%{$fg[cyan]%}[%~% ]%(?.%{$fg[green]%}.%{$fg[red]%})%B$%b ' diff --git a/themes/gentoo.zsh-theme b/themes/gentoo.zsh-theme index ee205d248..7ac461036 100644 --- a/themes/gentoo.zsh-theme +++ b/themes/gentoo.zsh-theme @@ -1,8 +1,28 @@ -function prompt_char { - if [ $UID -eq 0 ]; then echo "#"; else echo $; fi +autoload -Uz colors && colors + +autoload -Uz vcs_info +zstyle ':vcs_info:*' check-for-changes true +zstyle ':vcs_info:*' unstagedstr '%F{red}*' # display this when there are unstaged changes +zstyle ':vcs_info:*' stagedstr '%F{yellow}+' # display this when there are staged changes +zstyle ':vcs_info:*' actionformats '%F{5}(%F{2}%b%F{3}|%F{1}%a%c%u%m%F{5})%f ' +zstyle ':vcs_info:*' formats '%F{5}(%F{2}%b%c%u%m%F{5})%f ' +zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' +zstyle ':vcs_info:*' enable git cvs svn +zstyle ':vcs_info:git*+set-message:*' hooks untracked-git + ++vi-untracked-git() { + if command git status --porcelain 2>/dev/null | command grep -q '??'; then + hook_com[misc]='%F{red}?' + else + hook_com[misc]='' + fi +} + +gentoo_precmd() { + vcs_info } -PROMPT='%(!.%{$fg_bold[red]%}.%{$fg_bold[green]%}%n@)%m %{$fg_bold[blue]%}%(!.%1~.%~) $(git_prompt_info)%_$(prompt_char)%{$reset_color%} ' +autoload -U add-zsh-hook +add-zsh-hook precmd gentoo_precmd -ZSH_THEME_GIT_PROMPT_PREFIX="(" -ZSH_THEME_GIT_PROMPT_SUFFIX=") " +PROMPT='%(!.%B%F{red}.%B%F{green}%n@)%m %F{blue}%(!.%1~.%~) ${vcs_info_msg_0_}%F{blue}%(!.#.$)%k%b%f ' diff --git a/themes/gnzh.zsh-theme b/themes/gnzh.zsh-theme index c763ef3c6..1e6c4e93b 100644 --- a/themes/gnzh.zsh-theme +++ b/themes/gnzh.zsh-theme @@ -29,21 +29,15 @@ local return_code="%(?..%F{red}%? ↵%f)" local user_host="${PR_USER}%F{cyan}@${PR_HOST}" local current_dir="%B%F{blue}%~%f%b" -local rvm_ruby='' -if ${HOME}/.rvm/bin/rvm-prompt &> /dev/null; then # detect user-local rvm installation - rvm_ruby='%F{red}‹$(${HOME}/.rvm/bin/rvm-prompt i v g s)›%f' -elif which rvm-prompt &> /dev/null; then # detect system-wide rvm installation - rvm_ruby='%F{red}‹$(rvm-prompt i v g s)›%f' -elif which rbenv &> /dev/null; then # detect Simple Ruby Version Management - rvm_ruby='%F{red}‹$(rbenv version | sed -e "s/ (set.*$//")›%f' -fi local git_branch='$(git_prompt_info)' -PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch} +PROMPT="╭─${user_host} ${current_dir} \$(ruby_prompt_info) ${git_branch} ╰─$PR_PROMPT " RPROMPT="${return_code}" ZSH_THEME_GIT_PROMPT_PREFIX="%F{yellow}‹" ZSH_THEME_GIT_PROMPT_SUFFIX="› %f" +ZSH_THEME_RUBY_PROMPT_PREFIX="%F{red}‹" +ZSH_THEME_RUBY_PROMPT_SUFFIX="›%f" } diff --git a/themes/gozilla.zsh-theme b/themes/gozilla.zsh-theme index c6b752e9b..593b8ec35 100644 --- a/themes/gozilla.zsh-theme +++ b/themes/gozilla.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]%} %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX="(" ZSH_THEME_GIT_PROMPT_SUFFIX=")" diff --git a/themes/itchy.zsh-theme b/themes/itchy.zsh-theme index e1f2d56e2..41a42e88c 100644 --- a/themes/itchy.zsh-theme +++ b/themes/itchy.zsh-theme @@ -7,10 +7,12 @@ local pwd="%{$fg[yellow]%}%~%{$reset_color%}" PROMPT='${user}${host} ${pwd} ${smiley} ' -RPROMPT='$(rvm-prompt || rbenv version) %{$fg[white]%}$(git_prompt_info)%{$reset_color%}' +RPROMPT='$(ruby_prompt_info) %{$fg[white]%}$(git_prompt_info)%{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX="" ZSH_THEME_GIT_PROMPT_SUFFIX="" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%} ✗%{$reset_color%}" ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%} ✔%{$reset_color%}" +ZSH_THEME_RUBY_PROMPT_PREFIX="" +ZSH_THEME_RUBY_PROMPT_SUFFIX="" diff --git a/themes/jaischeema.zsh-theme b/themes/jaischeema.zsh-theme index da1dd1e5d..50d2bc4a5 100644 --- a/themes/jaischeema.zsh-theme +++ b/themes/jaischeema.zsh-theme @@ -1,16 +1,12 @@ # jaischeema.zsh-theme PROMPT='%{$fg_bold[magenta]%}%m%{$reset_color%} at %{$fg_bold[green]%}%~%{$reset_color%} %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}% %{$reset_color%}%{$fg[red]%}❯%{$reset_color%} ' +RPROMPT='$(ruby_prompt_info)' ZSH_THEME_GIT_PROMPT_PREFIX="±(%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%} " ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}) " -if which rbenv &> /dev/null; then - RPROMPT='%{$fg[red]%}$(rbenv version | sed -e "s/ (set.*$//")%{$reset_color%}' -else - if which rvm-prompt &> /dev/null; then - RPROMPT='%{$fg[red]%}$(rvm-prompt)%{$reset_color%}' - fi -fi +ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[red]%}" +ZSH_THEME_RUBY_PROMPT_SUFFIX="%{$reset_color%}" diff --git a/themes/jbergantine.zsh-theme b/themes/jbergantine.zsh-theme index d84247cff..8e9a8ee95 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]%} %{$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/jnrowe.zsh-theme b/themes/jnrowe.zsh-theme index bae88f7ab..9d8fb2488 100644 --- a/themes/jnrowe.zsh-theme +++ b/themes/jnrowe.zsh-theme @@ -33,6 +33,6 @@ function { local ret_status="%(?:%{$fg_bold[green]%}Ξ:%{$fg_bold[red]%}%S↑%s%?)" -PROMPT='${ret_status}%{$fg[blue]%}${PROMPT_HOST}%{$fg_bold[green]%}%p %{$fg_bold[yellow]%}%2~ ${vcs_info_msg_0_}${dir_status}%{$reset_color%} ' +PROMPT='${ret_status}%{$fg[blue]%}${PROMPT_HOST}%{$fg_bold[green]%} %{$fg_bold[yellow]%}%2~ ${vcs_info_msg_0_}${dir_status}%{$reset_color%} ' # vim: set ft=zsh ts=4 sw=4 et: diff --git a/themes/jtriley.zsh-theme b/themes/jtriley.zsh-theme index 15d77ed23..0f5b16f0a 100644 --- a/themes/jtriley.zsh-theme +++ b/themes/jtriley.zsh-theme @@ -1,8 +1,2 @@ -#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%}" - -#ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" -#ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -#ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" -#ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" diff --git a/themes/kafeitu.zsh-theme b/themes/kafeitu.zsh-theme index c4720b24d..af96f5e38 100644 --- a/themes/kafeitu.zsh-theme +++ b/themes/kafeitu.zsh-theme @@ -1,4 +1,4 @@ -PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%n%{$fg[cyan]%}@%{$fg_bold[green]%}%m %{$fg_bold[green]%}%p %{$fg[cyan]%}%~ %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' +PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%n%{$fg[cyan]%}@%{$fg_bold[green]%}%m %{$fg_bold[green]%} %{$fg[cyan]%}%~ %{$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/kiwi.zsh-theme b/themes/kiwi.zsh-theme index f93de2b75..94f0ffcbf 100644 --- a/themes/kiwi.zsh-theme +++ b/themes/kiwi.zsh-theme @@ -1,6 +1,4 @@ -# -# Kiwi ZSH Theme -# +(( $+functions[battery_pct_prompt] )) || function battery_pct_prompt { } PROMPT='%{$fg_bold[green]%}┌[%{$fg_bold[cyan]%}kiwish-4.2%{$fg_bold[green]%}]-(%{$fg_bold[white]%}%2~%{$fg_bold[green]%})-$(git_prompt_info)$(svn_prompt_info)$(battery_pct_prompt) └> % %{$reset_color%}' diff --git a/themes/linuxonly.zsh-theme b/themes/linuxonly.zsh-theme index f9e0aa07d..2afae8fc3 100644 --- a/themes/linuxonly.zsh-theme +++ b/themes/linuxonly.zsh-theme @@ -1,7 +1,6 @@ -# vim: set ts=2 textwidth=0 - autoload -U add-zsh-hook autoload -Uz vcs_info + local c0=$(printf "\033[0m") local c1=$(printf "\033[38;5;215m") local c2=$(printf "\033[38;5;209m") @@ -13,7 +12,6 @@ local c7=$(printf "\033[38;5;149m") local c8=$(printf "\033[38;5;126m") local c9=$(printf "\033[38;5;162m") - if [ "$TERM" = "linux" ]; then c1=$(printf "\033[34;1m") c2=$(printf "\033[35m") @@ -26,9 +24,6 @@ if [ "$TERM" = "linux" ]; then c9=$(printf "\033[34m") fi -#local newtv=$(perl $HOME/devel/newtv.pl) -local newtv='' - zstyle ':vcs_info:*' actionformats \ '%{$c8%}(%f%s)%{$c7%}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f ' zstyle ':vcs_info:*' formats \ @@ -42,38 +37,23 @@ prompt_jnrowe_precmd () { vcs_info if [ "${vcs_info_msg_0_}" = "" ]; then - #dir_status="|%F{3}%n%F{7}@%F{3}%m%F{7}:%F{9}%l%f" - #dir_status="$c1%n%F{7}@%F{9}%m%F{7}:%F{12}%/" dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})" - #dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$foopath%} %{$c0%}(%{$c5%}%?%{$c0%})" - - PROMPT='%{$fg_bold[green]%}%p%{$reset_color%}${vcs_info_msg_0_}${dir_status} ${ret_status}%{$reset_color%} + PROMPT='${dir_status} ${ret_status}%{$reset_color%} > ' elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})" PROMPT='${vcs_info_msg_0_} -%{$fg_bold[green]%}%p%{$reset_color%}${dir_status} ${vcs_info_msg_0_}%{$reset_color%} +${dir_status} ${vcs_info_msg_0_}%{$reset_color%} > ' - elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})" - PROMPT='${vcs_info_msg_0_} -%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%} +${dir_status}%{$reset_color%} %{$c9%}·>%{$c0%} ' else dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})" PROMPT='${vcs_info_msg_0_} -%{$fg_bold[green]%}%p%{$reset_color%}${dir_status} ${vcs_info_msg_0_}%{$reset_color%} +${dir_status} ${vcs_info_msg_0_}%{$reset_color%} > ' - fi } - - -#PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$reset_color%} ${vcs_info_msg_0_}${dir_status}%{$reset_color%} -#> ' - -# vim: set ft=zsh ts=4 sw=4 et: - - diff --git a/themes/macovsky-ruby.zsh-theme b/themes/macovsky-ruby.zsh-theme index abda6232c..d3ee200a9 100644..120000 --- a/themes/macovsky-ruby.zsh-theme +++ b/themes/macovsky-ruby.zsh-theme @@ -1,15 +1 @@ -# ZSH Theme - Preview: https://i.gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png -local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" - -if [ -e ~/.rvm/bin/rvm-prompt ]; then - PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b ' -else - if which rbenv &> /dev/null; then - PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b ' - fi -fi - -RPS1="${return_code}" - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" -ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" +macovsky.zsh-theme
\ No newline at end of file diff --git a/themes/macovsky.zsh-theme b/themes/macovsky.zsh-theme index d3f7d16b4..f527e5861 100644 --- a/themes/macovsky.zsh-theme +++ b/themes/macovsky.zsh-theme @@ -1,14 +1,12 @@ # ZSH Theme - Preview: https://i.gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" -if [ -e ~/.rvm/bin/rvm-prompt ]; then - PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b ' -else - if which rbenv &> /dev/null; then - PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b ' - fi -fi -RPS1="${return_code}" +PROMPT='%{$fg[green]%}%~%{$reset_color%} $(ruby_prompt_info) $(git_prompt_info)%{$reset_color%}%B$%b ' +RPROMPT="${return_code}" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" + + +ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[red]%}‹" +ZSH_THEME_RUBY_PROMPT_SUFFIX="› %{$reset_color%}" diff --git a/themes/maran.zsh-theme b/themes/maran.zsh-theme index 6fba04688..fddb7bc30 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/mira.zsh-theme b/themes/mira.zsh-theme index e6c952998..a7c60359c 100644 --- a/themes/mira.zsh-theme +++ b/themes/mira.zsh-theme @@ -4,22 +4,13 @@ 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='' -if which rvm-prompt &> /dev/null; then - rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}' -else - if which rbenv &> /dev/null; then - rvm_ruby='%{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}' - fi -fi +local nvm_node='%{$fg[green]%}‹node-$(nvm_prompt_info)›%{$reset_color%}' -local nvm_node='' -nvm_node='%{$fg[green]%}‹node-$(nvm_prompt_info)›%{$reset_color%}' +local jenv_java='%{$fg[blue]%}‹$(jenv_prompt_info)›%{$reset_color%}' -local jenv_java='' -jenv_java='%{$fg[blue]%}‹$(jenv_prompt_info)›%{$reset_color%}' +local git_branch='$(git_prompt_info)' -local git_branch='$(git_prompt_info)%{$reset_color%}' +local rvm_ruby='$(ruby_prompt_info)' PROMPT="╭─${user_host} ${current_dir} ${nvm_node} ${rvm_ruby} ${jenv_java} ${git_branch} ╰─%B$%b " @@ -27,3 +18,6 @@ RPS1="${return_code}" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}(" ZSH_THEME_GIT_PROMPT_SUFFIX=") %{$reset_color%}" + +ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[red]%}‹" +ZSH_THEME_RUBY_PROMPT_SUFFIX="›%{$reset_color%}" diff --git a/themes/mlh.zsh-theme b/themes/mlh.zsh-theme new file mode 100644 index 000000000..a21a546bc --- /dev/null +++ b/themes/mlh.zsh-theme @@ -0,0 +1,59 @@ +# The Official Theme of +## ## ## ## ## +### ### ## ## ## +#### #### ## ## ## +## ### ## ## ######### +## ## ## ## ## +## ## ## ## ## +## ## ######## ## ## + +# # # # # # # # # # # # # # # # # # +# # # Feel free to customize! # # # +# # # # # # # # # # # # # # # # # # + +# To easily discover colors and their codes, type `spectrum_ls` in the terminal + +AT_SYMBOL=" @ " +IN_SYMBOL=" in " +ON_SYMBOL=" on " +SYMBOL="$" + +USER_COLOR="%F{001}" +DEVICE_COLOR="%F{033}" +DIR_COLOR="%F{220}" +BRANCH_COLOR="%F{001}" +TIME_COLOR="%F{033}" + +username() { + echo "$USER_COLOR%n%f" +} + +# Returns device name +device() { + echo "$DEVICE_COLOR%m%f" +} + +# The current directory +directory() { + echo "$DIR_COLOR%1~%f" +} + +# Current time with milliseconds +current_time() { + echo "$TIME_COLOR%*%f" +} + +# Return status of the last command +return_status() { + echo "%(?..%F{001}out %?)%f" +} + +# Set the git_prompt_info text +ZSH_THEME_GIT_PROMPT_PREFIX="${ON_SYMBOL}${BRANCH_COLOR}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%f" +ZSH_THEME_GIT_PROMPT_DIRTY="" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +# %B and %b make the text bold +PROMPT='%b$(username)$AT_SYMBOL$(device)$IN_SYMBOL$(directory)$(git_prompt_info)%b $SYMBOL ' +RPROMPT="$(return_status) $(current_time)" diff --git a/themes/muse.zsh-theme b/themes/muse.zsh-theme index c7cd9ee30..84bee52c3 100644 --- a/themes/muse.zsh-theme +++ b/themes/muse.zsh-theme @@ -1,33 +1,16 @@ -#!/usr/bin/env zsh -#local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" - -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] - -PROMPT='%{$PROMPT_SUCCESS_COLOR%}%~%{$reset_color%}%{$GIT_PROMPT_INFO%}$(git_prompt_info)$(virtualenv_prompt_info)%{$GIT_DIRTY_COLOR%}$(git_prompt_status) %{$reset_color%}%{$PROMPT_PROMPT%}ᐅ%{$reset_color%} ' - -#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%}" +PROMPT="${FG[117]}%~%{$reset_color%}\$(git_prompt_info)\$(virtualenv_prompt_info)${FG[133]}\$(git_prompt_status) ${FG[077]}ᐅ%{$reset_color%} " + +ZSH_THEME_GIT_PROMPT_PREFIX=" ${FG[012]}(" +ZSH_THEME_GIT_PROMPT_SUFFIX="${FG[012]})%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY=" ${FG[133]}✘" +ZSH_THEME_GIT_PROMPT_CLEAN=" ${FG[118]}✔" + +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%}" ZSH_THEME_VIRTUALENV_PREFIX=" [" ZSH_THEME_VIRTUALENV_SUFFIX="]" diff --git a/themes/nebirhos.zsh-theme b/themes/nebirhos.zsh-theme index e2424465a..fc05e7955 100644 --- a/themes/nebirhos.zsh-theme +++ b/themes/nebirhos.zsh-theme @@ -11,7 +11,7 @@ else fi # Get the host name (first 4 chars) -HOST_PROMPT_="%{$fg_bold[red]%}@$HOST ➜ %{$fg_bold[cyan]%}%c " +HOST_PROMPT_="%{$fg_bold[red]%}@%m ➜ %{$fg_bold[cyan]%}%c " GIT_PROMPT="%{$fg_bold[blue]%}\$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}" PROMPT="$HOST_PROMPT_$RUBY_PROMPT_$GIT_PROMPT" diff --git a/themes/norm.zsh-theme b/themes/norm.zsh-theme index 13077ccf5..bd7ca568a 100644 --- a/themes/norm.zsh-theme +++ b/themes/norm.zsh-theme @@ -1,4 +1,7 @@ -PROMPT='%{$fg[yellow]%}λ %m %{$fg[green]%}%c %{$fg[yellow]%}→ $(git_prompt_info)%{$reset_color%}' +PROMPT='%{$fg[yellow]%}λ %m %{$fg[green]%}%c %{$fg[yellow]%}→ $(git_prompt_info)$(hg_prompt_info)%{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX="λ %{$fg[blue]%}git %{$fg[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[yellow]%} → %{$reset_color%}" +ZSH_THEME_HG_PROMPT_PREFIX="λ %{$fg[blue]%}hg %{$fg[red]%}" +ZSH_THEME_HG_PROMPT_SUFFIX="%{$fg[yellow]%} → %{$reset_color%}" + diff --git a/themes/obraun.zsh-theme b/themes/obraun.zsh-theme index 7af44056f..cc2769e4b 100644 --- a/themes/obraun.zsh-theme +++ b/themes/obraun.zsh-theme @@ -1,4 +1,4 @@ -if [ "$USER" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi +if [ "$USERNAME" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" diff --git a/themes/peepcode.zsh-theme b/themes/peepcode.zsh-theme index b6dfa6870..044534614 100644 --- a/themes/peepcode.zsh-theme +++ b/themes/peepcode.zsh-theme @@ -4,11 +4,11 @@ # git_repo_path() { - git rev-parse --git-dir 2>/dev/null + command git rev-parse --git-dir 2>/dev/null } git_commit_id() { - git rev-parse --short HEAD 2>/dev/null + command git rev-parse --short HEAD 2>/dev/null } git_mode() { @@ -22,23 +22,26 @@ git_mode() { } git_dirty() { - if [[ "$repo_path" != '.' && `git ls-files -m` != "" ]]; then + if [[ "$repo_path" != '.' && -n "$(command git ls-files -m)" ]]; then echo " %{$fg_bold[grey]%}✗%{$reset_color%}" fi } git_prompt() { local cb=$(git_current_branch) - if [ -n "$cb" ]; then + if [[ -n "$cb" ]]; then local repo_path=$(git_repo_path) echo " %{$fg_bold[grey]%}$cb %{$fg[white]%}$(git_commit_id)%{$reset_color%}$(git_mode)$(git_dirty)" fi } -local smiley="%(?,%{$fg[green]%}☺%{$reset_color%},%{$fg[red]%}☹%{$reset_color%})" +local smiley='%(?.%F{green}☺%f.%F{red}☹%f)' PROMPT=' -%~ -${smiley} %{$reset_color%}' +${VIRTUAL_ENV:+"($VIRTUAL_ENV) "}%~ +${smiley} ' -RPROMPT='%{$fg[white]%} $(ruby_prompt_info)$(git_prompt)%{$reset_color%}' +RPROMPT='%F{white} $(ruby_prompt_info)$(git_prompt)%{$reset_color%}' + +# Disable automatic virtualenv prompt change +export VIRTUAL_ENV_DISABLE_PROMPT=1 diff --git a/themes/pure.zsh-theme b/themes/pure.zsh-theme deleted file mode 100644 index 98c1312af..000000000 --- a/themes/pure.zsh-theme +++ /dev/null @@ -1,10 +0,0 @@ -print -P '%F{yellow}'Oh My Zsh pure theme: -cat <<-EOF - - The pure theme has been renamed as 'refined' as per the original author's - request. Change your ZSH_THEME to 'refined' to avoid seeing this warning. - -EOF -print -P '%f' - -source ${0:h:A}/refined.zsh-theme diff --git a/themes/pygmalion-virtualenv.zsh-theme b/themes/pygmalion-virtualenv.zsh-theme new file mode 100644 index 000000000..47b0b4fb1 --- /dev/null +++ b/themes/pygmalion-virtualenv.zsh-theme @@ -0,0 +1,53 @@ +# Yay! High voltage and arrows! + + +function _virtualenv_prompt_info { + if [[ -n "$(whence virtualenv_prompt_info)" ]]; then + if [ -n "$(whence pyenv_prompt_info)" ]; then + if [ "$1" = "inline" ]; then + ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX=%{$fg[blue]%}"::%{$fg[red]%}" + ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX="" + virtualenv_prompt_info + fi + [ "$(pyenv_prompt_info)" = "${PYENV_PROMPT_DEFAULT_VERSION}" ] && virtualenv_prompt_info + else + virtualenv_prompt_info + fi + fi +} + +prompt_setup_pygmalion(){ + setopt localoptions extendedglob + + ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}" + ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " + ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}" + ZSH_THEME_GIT_PROMPT_CLEAN="" + + base_prompt='$(_virtualenv_prompt_info)%{$fg[magenta]%}%n%{$reset_color%}%{$fg[cyan]%}@%{$reset_color%}%{$fg[yellow]%}%m%{$reset_color%}%{$fg[red]%}:%{$reset_color%}%{$fg[cyan]%}%0~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}' + post_prompt='%{$fg[cyan]%}⇒%{$reset_color%} ' + + base_prompt_nocolor=${base_prompt//\%\{[^\}]##\}} + post_prompt_nocolor=${post_prompt//\%\{[^\}]##\}} + + autoload -U add-zsh-hook + add-zsh-hook precmd prompt_pygmalion_precmd +} + +prompt_pygmalion_precmd(){ + setopt localoptions extendedglob + + local gitinfo=$(git_prompt_info) + local gitinfo_nocolor=${gitinfo//\%\{[^\}]##\}} + local exp_nocolor="$(print -P \"$base_prompt_nocolor$gitinfo_nocolor$post_prompt_nocolor\")" + local prompt_length=${#exp_nocolor} + + local nl="" + + if [[ $prompt_length -gt 40 ]]; then + nl=$'\n%{\r%}'; + fi + PROMPT="$base_prompt$gitinfo$nl$post_prompt" +} + +prompt_setup_pygmalion diff --git a/themes/pygmalion.zsh-theme b/themes/pygmalion.zsh-theme index 5f5fe7f9a..b13adfd5f 100644 --- a/themes/pygmalion.zsh-theme +++ b/themes/pygmalion.zsh-theme @@ -1,6 +1,8 @@ # Yay! High voltage and arrows! prompt_setup_pygmalion(){ + setopt localoptions extendedglob + ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}" @@ -9,26 +11,22 @@ prompt_setup_pygmalion(){ base_prompt='%{$fg[magenta]%}%n%{$reset_color%}%{$fg[cyan]%}@%{$reset_color%}%{$fg[yellow]%}%m%{$reset_color%}%{$fg[red]%}:%{$reset_color%}%{$fg[cyan]%}%0~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}' post_prompt='%{$fg[cyan]%}⇒%{$reset_color%} ' - base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g") - post_prompt_nocolor=$(echo "$post_prompt" | perl -pe "s/%\{[^}]+\}//g") + base_prompt_nocolor=${base_prompt//\%\{[^\}]##\}} + post_prompt_nocolor=${post_prompt//\%\{[^\}]##\}} - precmd_functions+=(prompt_pygmalion_precmd) + autoload -U add-zsh-hook + add-zsh-hook precmd prompt_pygmalion_precmd } prompt_pygmalion_precmd(){ + setopt localoptions extendedglob + local gitinfo=$(git_prompt_info) - local gitinfo_nocolor=$(echo "$gitinfo" | perl -pe "s/%\{[^}]+\}//g") + local gitinfo_nocolor=${gitinfo//\%\{[^\}]##\}} local exp_nocolor="$(print -P \"$base_prompt_nocolor$gitinfo_nocolor$post_prompt_nocolor\")" local prompt_length=${#exp_nocolor} - local nl="" - - if [[ $prompt_length -gt 40 ]]; then - nl=$'\n%{\r%}'; - fi - PROMPT="$base_prompt$gitinfo$nl$post_prompt" + PROMPT="${base_prompt}${gitinfo}${post_prompt}" } prompt_setup_pygmalion - - diff --git a/themes/random.zsh-theme b/themes/random.zsh-theme new file mode 100644 index 000000000..f0b8e5c18 --- /dev/null +++ b/themes/random.zsh-theme @@ -0,0 +1,47 @@ +# Deprecate ZSH_THEME_RANDOM_BLACKLIST +if [[ -n "$ZSH_THEME_RANDOM_BLACKLIST" ]]; then + echo '[oh-my-zsh] ZSH_THEME_RANDOM_BLACKLIST is deprecated. Use `ZSH_THEME_RANDOM_IGNORED` instead.' + ZSH_THEME_RANDOM_IGNORED=($ZSH_THEME_RANDOM_BLACKLIST) + unset ZSH_THEME_RANDOM_BLACKLIST +fi + +# Make themes a unique array +typeset -Ua themes + +if [[ "${(t)ZSH_THEME_RANDOM_CANDIDATES}" = array && ${#ZSH_THEME_RANDOM_CANDIDATES[@]} -gt 0 ]]; then + # Use ZSH_THEME_RANDOM_CANDIDATES if properly defined + themes=(${(@)ZSH_THEME_RANDOM_CANDIDATES:#random}) +else + # Look for themes in $ZSH_CUSTOM and $ZSH and add only the theme name + themes=( + "$ZSH_CUSTOM"/*.zsh-theme(N:t:r) + "$ZSH_CUSTOM"/themes/*.zsh-theme(N:t:r) + "$ZSH"/themes/*.zsh-theme(N:t:r) + ) + # Remove ignored themes from the list + for theme in random ${ZSH_THEME_RANDOM_IGNORED[@]}; do + themes=("${(@)themes:#$theme}") + done +fi + +# Choose a theme out of the pool of candidates +N=${#themes[@]} +(( N = (RANDOM%N) + 1 )) +RANDOM_THEME="${themes[$N]}" +unset N themes theme + +# Source theme +if [[ -f "$ZSH_CUSTOM/$RANDOM_THEME.zsh-theme" ]]; then + source "$ZSH_CUSTOM/$RANDOM_THEME.zsh-theme" +elif [[ -f "$ZSH_CUSTOM/themes/$RANDOM_THEME.zsh-theme" ]]; then + source "$ZSH_CUSTOM/themes/$RANDOM_THEME.zsh-theme" +elif [[ -f "$ZSH/themes/$RANDOM_THEME.zsh-theme" ]]; then + source "$ZSH/themes/$RANDOM_THEME.zsh-theme" +else + echo "[oh-my-zsh] Random theme '${RANDOM_THEME}' not found" + return 1 +fi + +if [[ -z "$ZSH_THEME_RANDOM_QUIET" ]]; then + echo "[oh-my-zsh] Random theme '${RANDOM_THEME}' loaded" +fi diff --git a/themes/re5et.zsh-theme b/themes/re5et.zsh-theme index 95af1e2ee..bdf342f49 100644 --- a/themes/re5et.zsh-theme +++ b/themes/re5et.zsh-theme @@ -1,4 +1,4 @@ -if [ "$USER" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="magenta"; fi +if [ "$USERNAME" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="magenta"; fi local return_code="%(?..%{$fg_bold[red]%}:( %?%{$reset_color%})" diff --git a/themes/refined.zsh-theme b/themes/refined.zsh-theme index 0e5681cc7..2a4188c9d 100644 --- a/themes/refined.zsh-theme +++ b/themes/refined.zsh-theme @@ -72,6 +72,7 @@ preexec() { precmd() { vcs_info # Get version control info before we start outputting stuff print -P "\n$(repo_information) %F{yellow}$(cmd_exec_time)%f" + unset cmd_timestamp #Reset cmd exec time. } # Define prompts diff --git a/themes/robbyrussell.zsh-theme b/themes/robbyrussell.zsh-theme index f9eca6a87..2fd5f2cdc 100644 --- a/themes/robbyrussell.zsh-theme +++ b/themes/robbyrussell.zsh-theme @@ -1,5 +1,5 @@ -local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )" -PROMPT='${ret_status} %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)' +PROMPT="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )" +PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)' ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " diff --git a/themes/simonoff.zsh-theme b/themes/simonoff.zsh-theme index 63ce4261b..ef91c5ee3 100644 --- a/themes/simonoff.zsh-theme +++ b/themes/simonoff.zsh-theme @@ -23,7 +23,7 @@ function precmd { local promptsize=${#${(%):---(%n@%M:%l)---()}} local pwdsize=${#${(%):-%~}} local gitbranch="$(git_prompt_info)" - local rvmprompt="$(rvm_prompt_info)" + local rvmprompt="$(ruby_prompt_info)" local gitbranchsize=${#${gitbranch:-''}} local rvmpromptsize=${#${rvmprompt:-''}} @@ -90,8 +90,8 @@ setprompt () { ZSH_THEME_GIT_PROMPT_SUFFIX="]" ### # Modify RVM prompt - ZSH_THEME_RVM_PROMPT_PREFIX=" [" - ZSH_THEME_RVM_PROMPT_SUFFIX="]" + ZSH_THEME_RUBY_PROMPT_PREFIX=" [" + ZSH_THEME_RUBY_PROMPT_SUFFIX="]" ### diff --git a/themes/smt.zsh-theme b/themes/smt.zsh-theme index f2b0526b7..7f54472c6 100644 --- a/themes/smt.zsh-theme +++ b/themes/smt.zsh-theme @@ -21,9 +21,9 @@ ZSH_THEME_GIT_PROMPT_SHA_BEFORE="➤ %{$fg_bold[yellow]%}" ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$reset_color%}" 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 - darcs show repo >/dev/null 2>/dev/null && echo "%{$fg_bold[green]%}❉%{$reset_color%}" && return + command git branch &>/dev/null && echo "%{$fg[green]%}±%{$reset_color%}" && return + command hg root &>/dev/null && echo "%{$fg_bold[red]%}☿%{$reset_color%}" && return + command darcs show repo &>/dev/null && echo "%{$fg_bold[green]%}❉%{$reset_color%}" && return echo "%{$fg[cyan]%}◯%{$reset_color%}" } @@ -36,47 +36,44 @@ 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() { - 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 - # Get the last commit. - last_commit=`git log --pretty=format:'%at' -1 2> /dev/null` - now=`date +%s` - seconds_since_last_commit=$((now-last_commit)) + local COLOR MINUTES HOURS DAYS SUB_HOURS SUB_MINUTES + local last_commit seconds_since_last_commit - # Totals - MINUTES=$((seconds_since_last_commit / 60)) - HOURS=$((seconds_since_last_commit/3600)) + # Only proceed if there is actually a commit + if ! last_commit=$(command git log --pretty=format:'%at' -1 2>/dev/null); then + echo "[$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL~%{$reset_color%}]" + return + fi - # Sub-hours and sub-minutes - DAYS=$((seconds_since_last_commit / 86400)) - SUB_HOURS=$((HOURS % 24)) - SUB_MINUTES=$((MINUTES % 60)) + # Totals + seconds_since_last_commit=$(( EPOCHSECONDS - last_commit )) + MINUTES=$(( seconds_since_last_commit / 60 )) + HOURS=$(( MINUTES / 60 )) - if [[ -n $(git status -s 2> /dev/null) ]]; then - if [ "$MINUTES" -gt 30 ]; then - COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG" - elif [ "$MINUTES" -gt 10 ]; then - COLOR="$ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM" - else - COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT" - fi - else - COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" - fi + # Sub-hours and sub-minutes + DAYS=$(( HOURS / 24 )) + SUB_HOURS=$(( HOURS % 24 )) + SUB_MINUTES=$(( MINUTES % 60 )) - if [ "$HOURS" -gt 24 ]; then - echo "[$COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}]" - elif [ "$MINUTES" -gt 60 ]; then - echo "[$COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}]" - else - echo "[$COLOR${MINUTES}m%{$reset_color%}]" - fi + if [[ -z "$(command git status -s 2>/dev/null)" ]]; then + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" + else + if [[ "$MINUTES" -gt 30 ]]; then + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG" + elif [[ "$MINUTES" -gt 10 ]]; then + COLOR="$ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM" else - COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" - echo "[$COLOR~]" + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT" fi fi + + if [[ "$HOURS" -gt 24 ]]; then + echo "[${COLOR}${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}]" + elif [[ "$MINUTES" -gt 60 ]]; then + echo "[${COLOR}${HOURS}h${SUB_MINUTES}m%{$reset_color%}]" + else + echo "[${COLOR}${MINUTES}m%{$reset_color%}]" + fi } PROMPT=' diff --git a/themes/sunrise.zsh-theme b/themes/sunrise.zsh-theme index e3f4019d6..11f6af127 100644 --- a/themes/sunrise.zsh-theme +++ b/themes/sunrise.zsh-theme @@ -1,5 +1,5 @@ # Sunrise theme for oh-my-zsh -# Intended to be used with Solarized: http://ethanschoonover.com/solarized +# Intended to be used with Solarized: https://ethanschoonover.com/solarized # Color shortcuts R=$fg_no_bold[red] @@ -9,7 +9,7 @@ Y=$fg_no_bold[yellow] B=$fg_no_bold[blue] RESET=$reset_color -if [ "$USER" = "root" ]; then +if [ "$USERNAME" = "root" ]; then PROMPTCOLOR="%{$R%}" PROMPTPREFIX="-!-"; else PROMPTCOLOR="" PROMPTPREFIX="---"; diff --git a/themes/suvash.zsh-theme b/themes/suvash.zsh-theme index 1680973df..850476cdf 100644 --- a/themes/suvash.zsh-theme +++ b/themes/suvash.zsh-theme @@ -8,20 +8,7 @@ function virtualenv_info { [[ -n "$VIRTUAL_ENV" ]] && echo '('${VIRTUAL_ENV:t}') ' } -function ruby_prompt { - if (( $+commands[rvm-prompt] )); then - print -n $ZSH_THEME_RUBY_PROMPT_PREFIX - print -n $(~/.rvm/bin/rvm-prompt) - print -n $ZSH_THEME_RUBY_PROMPT_SUFFIX - elif (( $+commands[rbenv] )); then - print -n $ZSH_THEME_RUBY_PROMPT_PREFIX - print -n $(rbenv version | sed -e "s/ (set.*$//") - print -n $ZSH_THEME_RUBY_PROMPT_SUFFIX - fi - return 0 -} - -PROMPT='%F{magenta}%n%f at %F{yellow}%m%f in %B%F{green}%~%f%b$(git_prompt_info)$(ruby_prompt) +PROMPT='%F{magenta}%n%f at %F{yellow}%m%f in %B%F{green}%~%f%b$(git_prompt_info)$(ruby_prompt_info) $(virtualenv_info) $(prompt_char) ' ZSH_THEME_GIT_PROMPT_PREFIX=' on %F{magenta}' diff --git a/themes/tjkirch.zsh-theme b/themes/tjkirch.zsh-theme index 446cde724..c51609860 100644 --- a/themes/tjkirch.zsh-theme +++ b/themes/tjkirch.zsh-theme @@ -10,6 +10,6 @@ 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) -%_$(prompt_char) ' +$(prompt_char) ' RPROMPT='%{$fg[green]%}[%*]%{$reset_color%}' diff --git a/themes/tjkirch_mod.zsh-theme b/themes/tjkirch_mod.zsh-theme index 1b206a7e1..2dd060ea1 100644 --- a/themes/tjkirch_mod.zsh-theme +++ b/themes/tjkirch_mod.zsh-theme @@ -8,6 +8,6 @@ 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) %_$(prompt_char) ' +)%{$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/trapd00r.zsh-theme b/themes/trapd00r.zsh-theme index 144d2549a..4e3238393 100644 --- a/themes/trapd00r.zsh-theme +++ b/themes/trapd00r.zsh-theme @@ -2,7 +2,7 @@ # # This theme needs a terminal supporting 256 colors as well as unicode. # In order to avoid external dependencies, it also has a zsh version of -# the perl script at https://github.com/trapd00r/utils/blob/master/zsh_path, +# the previously used perl script https://github.com/trapd00r/utils/blob/master/zsh_path, # which splits up the current path and makes it fancy. # # By default it spans over two lines like so: @@ -109,23 +109,23 @@ prompt_jnrowe_precmd () { vcs_info if [ "${vcs_info_msg_0_}" = "" ]; then dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" - PROMPT='%{$fg_bold[green]%}%p%{$reset_color%}${vcs_info_msg_0_}${dir_status} ${ret_status}%{$reset_color%} + PROMPT='${dir_status} ${ret_status}%{$reset_color%} > ' # modified, to be committed elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" PROMPT='${vcs_info_msg_0_}%{$30%} %{$bg_bold[red]%}%{$fg_bold[cyan]%}C%{$fg_bold[black]%}OMMIT%{$reset_color%} -%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%} +${dir_status}%{$reset_color%} > ' elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" PROMPT='${vcs_info_msg_0_}%{$bg_bold[red]%}%{$fg_bold[blue]%}D%{$fg_bold[black]%}IRTY%{$reset_color%} -%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%} +${dir_status}%{$reset_color%} %{$c13%}>%{$c0%} ' else dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" PROMPT='${vcs_info_msg_0_} -%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%} +${dir_status}%{$reset_color%} > ' fi } diff --git a/themes/wedisagree.zsh-theme b/themes/wedisagree.zsh-theme index 9bdbce40d..07006ecd9 100644 --- a/themes/wedisagree.zsh-theme +++ b/themes/wedisagree.zsh-theme @@ -28,7 +28,7 @@ PROMPT='%{$fg[magenta]%}[%c] %{$reset_color%}' RPROMPT='${time} %{$fg[magenta]%}$(git_prompt_info)%{$reset_color%}$(git_prompt_status)%{$reset_color%}$(git_prompt_ahead)%{$reset_color%}' # Add this at the start of RPROMPT to include rvm info showing ruby-version@gemset-name -# %{$fg[yellow]%}$(~/.rvm/bin/rvm-prompt)%{$reset_color%} +# $(ruby_prompt_info) # local time, color coded by last return code time_enabled="%(?.%{$fg[green]%}.%{$fg[red]%})%*%{$reset_color%}" @@ -48,6 +48,9 @@ ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%} ➜" # ⓡ ⑄ ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%} ♒" # ⓤ ⑊ ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg[blue]%} 𝝙" +ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[yellow]%}" +ZSH_THEME_RUBY_PROMPT_SUFFIX="%{$reset_color%}" + # More symbols to choose from: # ☀ ✹ ☄ ♆ ♀ ♁ ♐ ♇ ♈ ♉ ♚ ♛ ♜ ♝ ♞ ♟ ♠ ♣ ⚢ ⚲ ⚳ ⚴ ⚥ ⚤ ⚦ ⚒ ⚑ ⚐ ♺ ♻ ♼ ☰ ☱ ☲ ☳ ☴ ☵ ☶ ☷ # ✡ ✔ ✖ ✚ ✱ ✤ ✦ ❤ ➜ ➟ ➼ ✂ ✎ ✐ ⨀ ⨁ ⨂ ⨍ ⨎ ⨏ ⨷ ⩚ ⩛ ⩡ ⩱ ⩲ ⩵ ⩶ ⨠ diff --git a/themes/ys.zsh-theme b/themes/ys.zsh-theme index 89d5355dc..303c898b4 100644 --- a/themes/ys.zsh-theme +++ b/themes/ys.zsh-theme @@ -26,15 +26,26 @@ ys_hg_prompt_info() { if [ -d '.hg' ]; then echo -n "${YS_VCS_PROMPT_PREFIX1}hg${YS_VCS_PROMPT_PREFIX2}" echo -n $(hg branch 2>/dev/null) - if [ -n "$(hg status 2>/dev/null)" ]; then - echo -n "$YS_VCS_PROMPT_DIRTY" - else - echo -n "$YS_VCS_PROMPT_CLEAN" + if [[ "$(hg config oh-my-zsh.hide-dirty 2>/dev/null)" != "1" ]]; then + if [ -n "$(hg status 2>/dev/null)" ]; then + echo -n "$YS_VCS_PROMPT_DIRTY" + else + echo -n "$YS_VCS_PROMPT_CLEAN" + fi fi echo -n "$YS_VCS_PROMPT_SUFFIX" fi } +# Virtualenv +local venv_info='$(virtenv_prompt)' +YS_THEME_VIRTUALENV_PROMPT_PREFIX=" %{$fg[green]%}" +YS_THEME_VIRTUALENV_PROMPT_SUFFIX=" %{$reset_color%}%" +virtenv_prompt() { + [[ -n ${VIRTUAL_ENV} ]] || return + echo "${YS_THEME_VIRTUALENV_PROMPT_PREFIX}${VIRTUAL_ENV:t}${YS_THEME_VIRTUALENV_PROMPT_SUFFIX}" +} + local exit_code="%(?,,C:%{$fg[red]%}%?%{$reset_color%})" # Prompt format: @@ -55,6 +66,7 @@ PROMPT=" %{$terminfo[bold]$fg[yellow]%}%~%{$reset_color%}\ ${hg_info}\ ${git_info}\ +${venv_info}\ \ %{$fg[white]%}[%*] $exit_code %{$terminfo[bold]$fg[red]%}$ %{$reset_color%}" |