From d49397a01d0cc704008d6f1089ef6a7270d17116 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Tue, 18 Feb 2020 19:14:30 +0100 Subject: af-magic: fix dashed separator sizing and refactor Fixes #8081 --- themes/af-magic.zsh-theme | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'themes') diff --git a/themes/af-magic.zsh-theme b/themes/af-magic.zsh-theme index 30e997f8c..4d1a40947 100644 --- a/themes/af-magic.zsh-theme +++ b/themes/af-magic.zsh-theme @@ -2,29 +2,28 @@ # 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]${(l.COLUMNS..-.)}%{$reset_color%} -$FG[032]%~\ -$(git_prompt_info)$(hg_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="${RPROMPT}"'$FG[078]$(virtualenv_prompt_info)%{$reset_color%} $my_gray%n@%m%{$reset_color%}%' -else - RPROMPT="${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]" @@ -37,3 +36,7 @@ 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_PREFIX="]%{$reset_color%}" -- cgit v1.2.3-70-g09d2 From de261bd29cb5920b9ad37e67fe5e29ae3c348cfd Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Tue, 18 Feb 2020 22:28:58 +0100 Subject: af-magic: fix virtualenv prompt suffix --- themes/af-magic.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'themes') diff --git a/themes/af-magic.zsh-theme b/themes/af-magic.zsh-theme index 4d1a40947..148991fec 100644 --- a/themes/af-magic.zsh-theme +++ b/themes/af-magic.zsh-theme @@ -39,4 +39,4 @@ ZSH_THEME_HG_PROMPT_SUFFIX="$FG[075])%{$reset_color%}" # virtualenv settings ZSH_THEME_VIRTUALENV_PREFIX=" $FG[075][" -ZSH_THEME_VIRTUALENV_PREFIX="]%{$reset_color%}" +ZSH_THEME_VIRTUALENV_SUFFIX="]%{$reset_color%}" -- cgit v1.2.3-70-g09d2 From c1b798aff39942b2f23a0a5f2ef206ebc8ce4970 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Wed, 19 Feb 2020 00:16:54 +0100 Subject: agnoster: fix bzr prompt with breezy installed (#8646) * Change indentation to 2 spaces in prompt_bzr function * Check if in a bzr repository and optimize bzr calls in prompt_bzr --- themes/agnoster.zsh-theme | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) (limited to 'themes') 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() { -- cgit v1.2.3-70-g09d2 From 443ad8802415c111e8d59e110337e3fe12e2e698 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Wed, 19 Feb 2020 16:53:10 +0100 Subject: avit: replace custom prompt functions with OMZ ones Fixes #8637 --- themes/avit.zsh-theme | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) (limited to 'themes') diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme index aec14e4a6..3179bd837 100644 --- a/themes/avit.zsh-theme +++ b/themes/avit.zsh-theme @@ -1,12 +1,12 @@ # AVIT ZSH Theme PROMPT=' -$(_user_host)${_current_dir} $(git_prompt_info) $(_ruby_version) +$(_user_host)${_current_dir} $(git_prompt_info) $(ruby_prompt_info) %{$fg[$CARETCOLOR]%}▶%{$resetcolor%} ' PROMPT2='%{$fg[$CARETCOLOR]%}◀%{$reset_color%} ' -RPROMPT='$(_vi_status)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}' +RPROMPT='$(vi_mode_prompt_info)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}' local _current_dir="%{$fg_bold[blue]%}%3~%{$reset_color%} " local _return_status="%{$fg_bold[red]%}%(?..⍉)%{$reset_color%}" @@ -32,20 +32,6 @@ 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() { @@ -84,9 +70,9 @@ 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 +82,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]%}" -- cgit v1.2.3-70-g09d2 From 77813a330bbc716503dcc4d8d98b6d8ae6f74d03 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Wed, 19 Feb 2020 17:24:20 +0100 Subject: avit: clean up theme code --- themes/avit.zsh-theme | 51 +++++++++++++++++---------------------------------- 1 file changed, 17 insertions(+), 34 deletions(-) (limited to 'themes') diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme index 3179bd837..4f82f3414 100644 --- a/themes/avit.zsh-theme +++ b/themes/avit.zsh-theme @@ -1,27 +1,20 @@ # AVIT ZSH Theme +# 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%}" + PROMPT=' $(_user_host)${_current_dir} $(git_prompt_info) $(ruby_prompt_info) -%{$fg[$CARETCOLOR]%}▶%{$resetcolor%} ' +%{%F{%(!.red.white)}%}▶%{$resetcolor%} ' -PROMPT2='%{$fg[$CARETCOLOR]%}◀%{$reset_color%} ' +PROMPT2='%{%F{%(!.red.white)}%}◀%{$reset_color%} ' RPROMPT='$(vi_mode_prompt_info)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}' -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%}" - -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 -} - function _user_host() { + local me if [[ -n $SSH_CONNECTION ]]; then me="%n@%m" elif [[ $LOGNAME != $USER ]]; then @@ -35,39 +28,29 @@ function _user_host() { # 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 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)) + hours=$((seconds_since_last_commit / 3600)) - if [ $hours -ge 24 ]; then - commit_age="${days}d" - elif [ $minutes -gt 60 ]; then - commit_age="${sub_hours}h${sub_minutes}m" + if [[ $hours -ge 24 ]]; then + commit_age="$(( hours / 24 ))d" + elif [[ $hours -gt 0 ]]; then + commit_age+="$(( hours % 24 ))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 -- cgit v1.2.3-70-g09d2 From d76258ff554ea58d9865b9864f5fff1dd8d2e4bb Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Wed, 19 Feb 2020 18:19:46 +0100 Subject: avit: add years since last commit if appropriate --- themes/avit.zsh-theme | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'themes') diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme index 4f82f3414..51701572b 100644 --- a/themes/avit.zsh-theme +++ b/themes/avit.zsh-theme @@ -29,7 +29,7 @@ function _user_host() { # use a neutral color, otherwise colors will vary according to time. function _git_time_since_commit() { local last_commit now seconds_since_last_commit - local minutes hours commit_age + 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) @@ -37,12 +37,16 @@ function _git_time_since_commit() { # Totals minutes=$((seconds_since_last_commit / 60)) - hours=$((seconds_since_last_commit / 3600)) + hours=$((minutes / 60)) + days=$((hours / 24)) + years=$((days / 365)) - if [[ $hours -ge 24 ]]; then - commit_age="$(( hours / 24 ))d" + 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 % 24 ))h$(( minutes % 60 ))m" + commit_age+="${hours}h$(( minutes % 60 ))m" else commit_age="${minutes}m" fi -- cgit v1.2.3-70-g09d2 From 6adad5c300a6bfde33b593489cc1c3b645b721e8 Mon Sep 17 00:00:00 2001 From: Willy Weiskopf Date: Wed, 16 Jul 2014 22:21:09 -0600 Subject: Move random theme functionality into "random" theme The statements for selecting a random theme in oh-my-zsh.sh and the themes plugin are duplicate. Most people eventually settle on a theme, making those lines in oh-my-zsh.sh superfluous. To address those, it may makes sense to put the random theme functionality into a theme of its own (since themes are just zsh scripts. --- oh-my-zsh.sh | 25 ++++++------------------- plugins/themes/themes.plugin.zsh | 24 +++++++++++------------- themes/random.zsh-theme | 10 ++++++++++ 3 files changed, 27 insertions(+), 32 deletions(-) create mode 100644 themes/random.zsh-theme (limited to 'themes') diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index c3fae6efb..30259372c 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -97,25 +97,12 @@ done unset config_file # Load the theme -if [[ "$ZSH_THEME" == "random" ]]; then - if [[ "${(t)ZSH_THEME_RANDOM_CANDIDATES}" = "array" ]] && [[ "${#ZSH_THEME_RANDOM_CANDIDATES[@]}" -gt 0 ]]; then - themes=($ZSH/themes/${^ZSH_THEME_RANDOM_CANDIDATES}.zsh-theme) +if [ ! "$ZSH_THEME" = "" ]; then + if [ -f "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" ]; then + source "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" + elif [ -f "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" ]; then + source "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" else - themes=($ZSH/themes/*zsh-theme) - fi - N=${#themes[@]} - ((N=(RANDOM%N)+1)) - RANDOM_THEME=${themes[$N]} - source "$RANDOM_THEME" - echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..." -else - if [ ! "$ZSH_THEME" = "" ]; then - if [ -f "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" ]; then - source "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" - elif [ -f "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" ]; then - source "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" - else - source "$ZSH/themes/$ZSH_THEME.zsh-theme" - fi + source "$ZSH/themes/$ZSH_THEME.zsh-theme" fi fi diff --git a/plugins/themes/themes.plugin.zsh b/plugins/themes/themes.plugin.zsh index 2cd0ee327..ac4ccc980 100644 --- a/plugins/themes/themes.plugin.zsh +++ b/plugins/themes/themes.plugin.zsh @@ -1,19 +1,17 @@ function theme { - if [ -z "$1" ] || [ "$1" = "random" ]; then - themes=($ZSH/themes/*zsh-theme) - N=${#themes[@]} - ((N=(RANDOM%N)+1)) - RANDOM_THEME=${themes[$N]} - source "$RANDOM_THEME" - echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..." + if [ -z "$1" ]; then + 1="random" + fi + + if [ -f "$ZSH_CUSTOM/$1.zsh-theme" ] + then + source "$ZSH_CUSTOM/$1.zsh-theme" + elif [ -f "$ZSH_CUSTOM/themes/$1.zsh-theme" ] + then + source "$ZSH_CUSTOM/themes/$1.zsh-theme" else - if [ -f "$ZSH_CUSTOM/themes/$1.zsh-theme" ] - then - source "$ZSH_CUSTOM/themes/$1.zsh-theme" - else - source "$ZSH/themes/$1.zsh-theme" - fi + source "$ZSH/themes/$1.zsh-theme" fi } diff --git a/themes/random.zsh-theme b/themes/random.zsh-theme new file mode 100644 index 000000000..739567662 --- /dev/null +++ b/themes/random.zsh-theme @@ -0,0 +1,10 @@ +if [[ "${(t)ZSH_THEME_RANDOM_CANDIDATES}" = "array" ]] && [[ "${#ZSH_THEME_RANDOM_CANDIDATES[@]}" -gt 0 ]]; then + themes=($ZSH/themes/${^ZSH_THEME_RANDOM_CANDIDATES}.zsh-theme) +else + themes=($ZSH/themes/*zsh-theme) +fi +N=${#themes[@]} +((N=(RANDOM%N)+1)) +RANDOM_THEME=${themes[$N]} +source "$RANDOM_THEME" +echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..." -- cgit v1.2.3-70-g09d2 From b297bf92964e04e24f960f4e38acdb9b740d2d9f Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Wed, 19 Feb 2020 18:42:05 +0100 Subject: Add themes in $ZSH_CUSTOM to the pool of candidates Also add comments and unset leftover variables, and print only the name of the theme loaded. When looking for $ZSH_CUSTOM themes, the chosen algorithm is to add the theme names to the pool disregarding the path, and then source whatever theme is selected with the same logic as the init script, which is to source first custom themes even if there is another default theme of the same name. Co-authored-by: Mihai Serban --- themes/random.zsh-theme | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) (limited to 'themes') diff --git a/themes/random.zsh-theme b/themes/random.zsh-theme index 739567662..92d2a6847 100644 --- a/themes/random.zsh-theme +++ b/themes/random.zsh-theme @@ -1,10 +1,34 @@ -if [[ "${(t)ZSH_THEME_RANDOM_CANDIDATES}" = "array" ]] && [[ "${#ZSH_THEME_RANDOM_CANDIDATES[@]}" -gt 0 ]]; then - themes=($ZSH/themes/${^ZSH_THEME_RANDOM_CANDIDATES}.zsh-theme) +# 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 - themes=($ZSH/themes/*zsh-theme) + # Look for themes in $ZSH_CUSTOM and $ZSH and add only the theme name (:t) + themes=( + "$ZSH_CUSTOM"/*.zsh-theme(N:t:r) + "$ZSH_CUSTOM"/themes/*.zsh-theme(N:t:r) + "$ZSH"/themes/*.zsh-theme(N:t:r) + ) fi + +# Choose a theme out of the pool of candidates N=${#themes[@]} -((N=(RANDOM%N)+1)) -RANDOM_THEME=${themes[$N]} -source "$RANDOM_THEME" -echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..." +(( N = (RANDOM%N) + 1 )) +RANDOM_THEME="${themes[$N]}" +unset N themes + +# 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" -- cgit v1.2.3-70-g09d2 From 3d4890dcc07478e7129de1e79afedafd3f08ffbc Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Wed, 19 Feb 2020 19:53:37 +0100 Subject: Add blacklist variable for random theme Co-authored-by: Fran Garcia --- themes/random.zsh-theme | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'themes') diff --git a/themes/random.zsh-theme b/themes/random.zsh-theme index 92d2a6847..43f6cbb60 100644 --- a/themes/random.zsh-theme +++ b/themes/random.zsh-theme @@ -5,19 +5,23 @@ if [[ "${(t)ZSH_THEME_RANDOM_CANDIDATES}" = array && ${#ZSH_THEME_RANDOM_CANDIDA # 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 (:t) + # 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 +unset N themes theme # Source theme if [[ -f "$ZSH_CUSTOM/$RANDOM_THEME.zsh-theme" ]]; then -- cgit v1.2.3-70-g09d2 From d959283898f4c969579346a6d3596d9dd8fa3532 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Tue, 25 Feb 2020 12:21:06 +0100 Subject: avit: fix prompt sequence (fixes #8678) --- themes/avit.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'themes') diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme index 51701572b..0261f0ff3 100644 --- a/themes/avit.zsh-theme +++ b/themes/avit.zsh-theme @@ -7,9 +7,9 @@ typeset +H _hist_no="%{$fg[grey]%}%h%{$reset_color%}" PROMPT=' $(_user_host)${_current_dir} $(git_prompt_info) $(ruby_prompt_info) -%{%F{%(!.red.white)}%}▶%{$resetcolor%} ' +%{%(!.%F{red}.%F{white})%}▶%{$resetcolor%} ' -PROMPT2='%{%F{%(!.red.white)}%}◀%{$reset_color%} ' +PROMPT2='%{%(!.%F{red}.%F{white})%}◀%{$reset_color%} ' RPROMPT='$(vi_mode_prompt_info)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}' -- cgit v1.2.3-70-g09d2 From dbd2f77bd9c13f017550ee6dae37ff95a2c3d183 Mon Sep 17 00:00:00 2001 From: Julian Parsert Date: Thu, 27 Feb 2020 17:28:08 +0000 Subject: norm: add hg prompt (#6725) --- themes/norm.zsh-theme | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'themes') 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%}" + -- cgit v1.2.3-70-g09d2