diff options
Diffstat (limited to 'themes')
-rw-r--r-- | themes/af-magic.zsh-theme | 45 | ||||
-rw-r--r-- | themes/agnoster.zsh-theme | 40 | ||||
-rw-r--r-- | themes/avit.zsh-theme | 81 | ||||
-rw-r--r-- | themes/bira.zsh-theme | 2 | ||||
-rw-r--r-- | themes/candy-kingdom.zsh-theme | 24 | ||||
-rw-r--r-- | themes/evan.zsh-theme | 4 | ||||
-rw-r--r-- | themes/gallifrey.zsh-theme | 2 | ||||
-rw-r--r-- | themes/kiwi.zsh-theme | 4 | ||||
-rw-r--r-- | themes/norm.zsh-theme | 5 | ||||
-rw-r--r-- | themes/pygmalion-virtualenv.zsh-theme | 5 | ||||
-rw-r--r-- | themes/pygmalion.zsh-theme | 5 | ||||
-rw-r--r-- | themes/random.zsh-theme | 38 | ||||
-rw-r--r-- | themes/robbyrussell.zsh-theme | 4 | ||||
-rw-r--r-- | themes/sunrise.zsh-theme | 2 |
14 files changed, 146 insertions, 115 deletions
diff --git a/themes/af-magic.zsh-theme b/themes/af-magic.zsh-theme index 1c6d1732c..148991fec 100644 --- a/themes/af-magic.zsh-theme +++ b/themes/af-magic.zsh-theme @@ -2,32 +2,41 @@ # 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 { + [[ -n "${VIRTUAL_ENV-}" && -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" && "$PS1" = \(* ]] \ + && echo $(( COLUMNS - ${#VIRTUAL_ENV} - 3 )) \ + || echo $COLUMNS +} -# color vars -eval my_gray='$FG[237]' -eval my_orange='$FG[214]' +# 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 518a14a37..8c700d06a 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -140,24 +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() { diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme index aec14e4a6..0261f0ff3 100644 --- a/themes/avit.zsh-theme +++ b/themes/avit.zsh-theme @@ -1,27 +1,20 @@ # 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) +%{%(!.%F{red}.%F{white})%}▶%{$resetcolor%} ' -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='%{%(!.%F{red}.%F{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 @@ -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/bira.zsh-theme b/themes/bira.zsh-theme index d00f72f5d..cdae68d6c 100644 --- a/themes/bira.zsh-theme +++ b/themes/bira.zsh-theme @@ -16,7 +16,7 @@ local venv_prompt='$(virtualenv_prompt_info)' ZSH_THEME_RVM_PROMPT_OPTIONS="i v g" -PROMPT="╭─${venv_prompt}${user_host}${current_dir}${rvm_ruby}${git_branch} +PROMPT="╭─${user_host}${current_dir}${rvm_ruby}${git_branch}${venv_prompt} ╰─%B${user_symbol}%b " RPROMPT="%B${return_code}%b" 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/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/gallifrey.zsh-theme b/themes/gallifrey.zsh-theme index 768547064..47b057fa3 100644 --- a/themes/gallifrey.zsh-theme +++ b/themes/gallifrey.zsh-theme @@ -1,4 +1,4 @@ -# ZSH Theme - Preview: https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#gallifrey +# ZSH Theme - Preview: https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#gallifrey return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" host_color="%(!.%{$fg[red]%}.%{$fg[green]%})" 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/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/pygmalion-virtualenv.zsh-theme b/themes/pygmalion-virtualenv.zsh-theme index ea28e125a..605e3d10c 100644 --- a/themes/pygmalion-virtualenv.zsh-theme +++ b/themes/pygmalion-virtualenv.zsh-theme @@ -28,7 +28,8 @@ prompt_setup_pygmalion(){ base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g") post_prompt_nocolor=$(echo "$post_prompt" | perl -pe "s/%\{[^}]+\}//g") - precmd_functions+=(prompt_pygmalion_precmd) + autoload -U add-zsh-hook + add-zsh-hook precmd prompt_pygmalion_precmd } prompt_pygmalion_precmd(){ @@ -46,5 +47,3 @@ prompt_pygmalion_precmd(){ } prompt_setup_pygmalion - - diff --git a/themes/pygmalion.zsh-theme b/themes/pygmalion.zsh-theme index 5f5fe7f9a..cd773e4a4 100644 --- a/themes/pygmalion.zsh-theme +++ b/themes/pygmalion.zsh-theme @@ -12,7 +12,8 @@ prompt_setup_pygmalion(){ base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g") post_prompt_nocolor=$(echo "$post_prompt" | perl -pe "s/%\{[^}]+\}//g") - precmd_functions+=(prompt_pygmalion_precmd) + autoload -U add-zsh-hook + add-zsh-hook precmd prompt_pygmalion_precmd } prompt_pygmalion_precmd(){ @@ -30,5 +31,3 @@ prompt_pygmalion_precmd(){ } prompt_setup_pygmalion - - diff --git a/themes/random.zsh-theme b/themes/random.zsh-theme new file mode 100644 index 000000000..43f6cbb60 --- /dev/null +++ b/themes/random.zsh-theme @@ -0,0 +1,38 @@ +# 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) +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 blacklisted themes from the list + for theme in ${ZSH_THEME_RANDOM_BLACKLIST[@]}; 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 + +echo "[oh-my-zsh] Random theme '${RANDOM_THEME}' loaded" 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/sunrise.zsh-theme b/themes/sunrise.zsh-theme index e3f4019d6..2111576c3 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] |