summaryrefslogtreecommitdiff
path: root/themes
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2023-11-04 18:38:46 -0700
committerTuowen Zhao <ztuowen@gmail.com>2023-11-04 18:38:46 -0700
commit4d908094fdc2a0c0e9a0a072eba213fab7adef43 (patch)
tree7c17e70bcdeebbe96c84d849bdf17882007480d8 /themes
parent4b0bbc0b263a150eb9a9b59f196914629be06a9b (diff)
parent632ed413a9ce62747ded83d7736491b081be4b49 (diff)
downloadzsh-4d908094fdc2a0c0e9a0a072eba213fab7adef43.tar.gz
zsh-4d908094fdc2a0c0e9a0a072eba213fab7adef43.tar.bz2
zsh-4d908094fdc2a0c0e9a0a072eba213fab7adef43.zip
Merge remote-tracking branch 'github/master'HEADmaster
Diffstat (limited to 'themes')
-rw-r--r--themes/agnoster.zsh-theme4
-rw-r--r--themes/avit.zsh-theme7
-rw-r--r--themes/bureau.zsh-theme7
-rw-r--r--themes/fino-time.zsh-theme1
-rw-r--r--themes/gallois.zsh-theme136
-rw-r--r--themes/gnzh.zsh-theme2
-rw-r--r--themes/half-life.zsh-theme6
-rw-r--r--themes/michelebologna.zsh-theme11
-rw-r--r--themes/mortalscumbag.zsh-theme8
-rw-r--r--themes/oldgallois.zsh-theme24
-rw-r--r--themes/robbyrussell.zsh-theme4
11 files changed, 187 insertions, 23 deletions
diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme
index 3abd9f799..af0c33754 100644
--- a/themes/agnoster.zsh-theme
+++ b/themes/agnoster.zsh-theme
@@ -109,7 +109,9 @@ prompt_git() {
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)"
+ ref=$(git symbolic-ref HEAD 2> /dev/null) || \
+ ref="◈ $(git describe --exact-match --tags HEAD 2> /dev/null)" || \
+ ref="➦ $(git rev-parse --short HEAD 2> /dev/null)"
if [[ -n $dirty ]]; then
prompt_segment yellow black
else
diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme
index 1279ea919..206274462 100644
--- a/themes/avit.zsh-theme
+++ b/themes/avit.zsh-theme
@@ -11,7 +11,12 @@ $(_user_host)${_current_dir} $(git_prompt_info) $(ruby_prompt_info)
PROMPT2='%{%(!.${fg[red]}.${fg[white]})%}◀%{$reset_color%} '
-RPROMPT='$(vi_mode_prompt_info)%{$(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)%}'
+if [[ -z $RPROMPT ]]; then
+ RPROMPT=$__RPROMPT
+else
+ RPROMPT="${RPROMPT} ${__RPROMPT}"
+fi
function _user_host() {
local me
diff --git a/themes/bureau.zsh-theme b/themes/bureau.zsh-theme
index 698aa2ff8..e87a594cd 100644
--- a/themes/bureau.zsh-theme
+++ b/themes/bureau.zsh-theme
@@ -15,6 +15,7 @@ ZSH_THEME_GIT_PROMPT_BEHIND="%{$fg[magenta]%}▾%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_STAGED="%{$fg_bold[green]%}●%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_UNSTAGED="%{$fg_bold[yellow]%}●%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[red]%}●%{$reset_color%}"
+ZSH_THEME_GIT_PROMPT_STASHED="(%{$fg_bold[blue]%}✹%{$reset_color%})"
bureau_git_info () {
local ref
@@ -67,6 +68,12 @@ bureau_git_status() {
}
bureau_git_prompt() {
+ # ignore non git folders and hidden repos (adapted from lib/git.zsh)
+ if ! command git rev-parse --git-dir &> /dev/null \
+ || [[ "$(command git config --get oh-my-zsh.hide-info 2>/dev/null)" == 1 ]]; then
+ return
+ fi
+
# check git information
local gitinfo=$(bureau_git_info)
if [[ -z "$gitinfo" ]]; then
diff --git a/themes/fino-time.zsh-theme b/themes/fino-time.zsh-theme
index c7e2d965e..3f9360ac5 100644
--- a/themes/fino-time.zsh-theme
+++ b/themes/fino-time.zsh-theme
@@ -12,6 +12,7 @@
# Also borrowing from http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/
function virtualenv_info {
+ [ $CONDA_DEFAULT_ENV ] && echo "($CONDA_DEFAULT_ENV) "
[ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') '
}
diff --git a/themes/gallois.zsh-theme b/themes/gallois.zsh-theme
index bb97bfb17..3fc349072 100644
--- a/themes/gallois.zsh-theme
+++ b/themes/gallois.zsh-theme
@@ -1,24 +1,140 @@
# 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_PREFIX="%{$fg[cyan]%}[%{$fg[green]%}"
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[cyan]%}]"
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_CLEAN=""
# Customized git status, oh-my-zsh currently does not allow render dirty status before branch
git_custom_status() {
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}"
+ print "%{${fg_bold[yellow]}%}$(work_in_progress)%{$reset_color%}\
+${ZSH_THEME_GIT_PROMPT_PREFIX}$(parse_git_dirty)${branch}\
+${ZSH_THEME_GIT_PROMPT_SUFFIX}"
+}
+autoload -U colors && colors
+
+#export VCS_PROMPT=hg_prompt_info
+export VCS_PROMPT=git_custom_status
+
+base_prompt="%{$fg[cyan]%}[%~% ]%(?.%{$fg[green]%}.%{$fg[red]%})%B$%b "
+custom_prompt=""
+last_run_time=""
+last_vcs_info=""
+
+
+function pipestatus_parse {
+ PIPESTATUS="$pipestatus"
+ ERROR=0
+ for i in "${(z)PIPESTATUS}"; do
+ if [[ "$i" -ne 0 ]]; then
+ ERROR=1
+ fi
+ done
+
+ if [[ "$ERROR" -ne 0 ]]; then
+ print "[%{$fg[red]%}$PIPESTATUS%{$fg[cyan]%}]"
+ fi
}
-# RVM component of prompt
-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)${RPS1:+ $RPS1}"
PROMPT='%{$fg[cyan]%}[%~% ]%(?.%{$fg[green]%}.%{$fg[red]%})%B$%b '
+function preexec() {
+ last_run_time=$(perl -MTime::HiRes=time -e 'printf "%.9f\n", time')
+}
+
+function duration() {
+ local duration
+ local now=$(perl -MTime::HiRes=time -e 'printf "%.9f\n", time')
+ local last=$1
+ local last_split=("${(@s/./)last}")
+ local now_split=("${(@s/./)now}")
+ local T=$((now_split[1] - last_split[1]))
+ local D=$((T/60/60/24))
+ local H=$((T/60/60%24))
+ local M=$((T/60%60))
+ local S=$((T%60))
+ local s=$(((now_split[2] - last_split[2]) / 1000000000.))
+ local m=$(((now_split[2] - last_split[2]) / 1000000.))
+
+ (( $D > 0 )) && duration+="${D}d"
+ (( $H > 0 )) && duration+="${H}h"
+ (( $M > 0 )) && duration+="${M}m"
+
+ if [[ $S -le 0 ]]; then
+ printf "%ims" "$m"
+ else
+ if ! [[ -z $duration ]] && printf "%s" "$duration"
+ local sec_milli=$((S + s))
+ printf "%.3fs" "$sec_milli"
+ fi
+}
+
+function precmd() {
+ RETVAL=$(pipestatus_parse)
+ local info=""
+
+ if [ ! -z "$last_run_time" ]; then
+ local elapsed=$(duration $last_run_time)
+ last_run_time=$(print $last_run_time | tr -d ".")
+ if [ $(( $(perl -MTime::HiRes=time -e 'printf "%.9f\n", time' | tr -d ".") - $last_run_time )) -gt $(( 120 * 1000 * 1000 * 1000 )) ]; then
+ local elapsed_color="%{$fg[magenta]%}"
+ elif [ $(( $(perl -MTime::HiRes=time -e 'printf "%.9f\n", time' | tr -d ".") - $last_run_time )) -gt $(( 60 * 1000 * 1000 * 1000 )) ]; then
+ local elapsed_color="%{$fg[red]%}"
+ elif [ $(( $(perl -MTime::HiRes=time -e 'printf "%.9f\n", time' | tr -d ".") - $last_run_time )) -gt $(( 10 * 1000 * 1000 * 1000 )) ]; then
+ local elapsed_color="%{$fg[yellow]%}"
+ else
+ local elapsed_color="%{$fg[green]%}"
+ fi
+ info=$(printf "%s%s%s%s%s" "%{$fg[cyan]%}[" "$elapsed_color" "$elapsed" "%{$fg[cyan]%}]" "$RETVAL")
+ unset last_run_time
+ fi
+
+ if [ -z "$info" -a ! -z "$last_vcs_info" ]; then
+ custom_prompt="$last_vcs_info$base_prompt"
+ return;
+ fi
+
+ if (( ${+VCS_PROMPT} )); then
+ last_vcs_info=$($VCS_PROMPT)
+ if [ ! -z "$last_vcs_info" ]; then
+ [ -z "$info" ] && info=$last_vcs_info || info="$info$last_vcs_info"
+ fi
+ fi
+
+ [ -z "$info" ] && custom_prompt="$base_prompt" || custom_prompt="$info$base_prompt"
+}
+
+function hg_prompt_info() {
+ unset output info parts branch_parts branch
+
+ local output=""
+ if ! output="$(hg status 2> /dev/null)"; then
+ return
+ fi
+
+ local info=$(hg log -l1 --template '{author}:{node|short}:{remotenames}:{phabdiff}')
+ local parts=(${(@s/:/)info})
+ local branch_parts=(${(@s,/,)parts[3]})
+ local branch=${branch_parts[-1]}
+ [ ! -z "${parts[3]}" ] && [[ "${parts[1]}" =~ "$USER@" ]] && branch=${parts[3]}
+ [ -z "${parts[3]}" ] && branch=${parts[2]}
+
+ if [[ ! -z "$output" ]]; then
+ local color="%{$fg[red]%}"
+ elif [[ "${branch}" == "master" || "${branch}" == "warm" ]]; then
+ local color="%{$fg[yellow]%}"
+ else
+ local color="%{$fg[green]%}"
+ fi
+
+ print "%{$fg[cyan]%}[${color}${branch}%{$fg[cyan]%}]"
+}
+
+setopt PROMPT_SUBST
+PROMPT='$custom_prompt'
+
+
diff --git a/themes/gnzh.zsh-theme b/themes/gnzh.zsh-theme
index 1e6c4e93b..ca62320e2 100644
--- a/themes/gnzh.zsh-theme
+++ b/themes/gnzh.zsh-theme
@@ -21,7 +21,7 @@ fi
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
PR_HOST='%F{red}%M%f' # SSH
else
- PR_HOST='%F{green}%M%f' # no SSH
+ PR_HOST='%F{green}%m%f' # no SSH
fi
diff --git a/themes/half-life.zsh-theme b/themes/half-life.zsh-theme
index c4d785126..2ad84ac83 100644
--- a/themes/half-life.zsh-theme
+++ b/themes/half-life.zsh-theme
@@ -89,5 +89,9 @@ ZSH_THEME_RUBY_PROMPT_PREFIX="with%F{red} "
ZSH_THEME_RUBY_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_RVM_PROMPT_OPTIONS="v g"
+# virtualenv prompt settings
+ZSH_THEME_VIRTUALENV_PREFIX=" with%F{red} "
+ZSH_THEME_VIRTUALENV_SUFFIX="%{$reset_color%}"
+
setopt prompt_subst
-PROMPT="${purple}%n%{$reset_color%} in ${limegreen}%~%{$reset_color%}\$(ruby_prompt_info)\$vcs_info_msg_0_${orange} λ%{$reset_color%} "
+PROMPT="${purple}%n%{$reset_color%} in ${limegreen}%~%{$reset_color%}\$(virtualenv_prompt_info)\$(ruby_prompt_info)\$vcs_info_msg_0_${orange} λ%{$reset_color%} "
diff --git a/themes/michelebologna.zsh-theme b/themes/michelebologna.zsh-theme
index bb86d68db..b13b2caf1 100644
--- a/themes/michelebologna.zsh-theme
+++ b/themes/michelebologna.zsh-theme
@@ -29,14 +29,13 @@ local cyan="%{$fg_bold[cyan]%}"
local yellow="%{$fg_bold[yellow]%}"
local blue="%{$fg_bold[blue]%}"
local magenta="%{$fg_bold[magenta]%}"
-local white="%{$fg_bold[white]%}"
local reset="%{$reset_color%}"
local -a color_array
-color_array=($green $red $cyan $yellow $blue $magenta $white)
+color_array=($green $red $cyan $yellow $blue $magenta)
-local username_color=$white
-local hostname_color=$color_array[$[((#HOST))%7+1]] # choose hostname color based on first character
+local username_color=$blue
+local hostname_color=$color_array[$[((#HOST))%6+1]] # choose hostname color based on first character
local current_dir_color=$blue
local username="%n"
@@ -66,10 +65,10 @@ function michelebologna_git_prompt {
local out=$(git_prompt_info)$(git_prompt_status)$(git_remote_status)
[[ -n $out ]] || return
printf " %s(%s%s%s)%s" \
- "%{$fg_bold[white]%}" \
+ "%{$fg_bold[blue]%}" \
"%{$fg_bold[green]%}" \
"$out" \
- "%{$fg_bold[white]%}" \
+ "%{$fg_bold[blue]%}" \
"%{$reset_color%}"
}
diff --git a/themes/mortalscumbag.zsh-theme b/themes/mortalscumbag.zsh-theme
index d81a7ca06..36301cb76 100644
--- a/themes/mortalscumbag.zsh-theme
+++ b/themes/mortalscumbag.zsh-theme
@@ -51,8 +51,14 @@ function ssh_connection() {
fi
}
+function _toolbox_prompt_info() {
+ if typeset -f toolbox_prompt_info > /dev/null; then
+ toolbox_prompt_info
+ fi
+}
+
local ret_status="%(?:%{$fg_bold[green]%}:%{$fg_bold[red]%})%?%{$reset_color%}"
-PROMPT=$'\n$(ssh_connection)%{$fg_bold[green]%}%n@%m%{$reset_color%}$(my_git_prompt) : %~\n[${ret_status}] %# '
+PROMPT=$'\n$(_toolbox_prompt_info)$(ssh_connection)%{$fg_bold[green]%}%n@%m%{$reset_color%}$(my_git_prompt) : %~\n[${ret_status}] %# '
ZSH_THEME_PROMPT_RETURNCODE_PREFIX="%{$fg_bold[red]%}"
ZSH_THEME_GIT_PROMPT_PREFIX=" $fg[white]‹ %{$fg_bold[yellow]%}"
diff --git a/themes/oldgallois.zsh-theme b/themes/oldgallois.zsh-theme
new file mode 100644
index 000000000..bb97bfb17
--- /dev/null
+++ b/themes/oldgallois.zsh-theme
@@ -0,0 +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
+git_custom_status() {
+ 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_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)${RPS1:+ $RPS1}"
+PROMPT='%{$fg[cyan]%}[%~% ]%(?.%{$fg[green]%}.%{$fg[red]%})%B$%b '
diff --git a/themes/robbyrussell.zsh-theme b/themes/robbyrussell.zsh-theme
index 2fd5f2cdc..173e6d579 100644
--- a/themes/robbyrussell.zsh-theme
+++ b/themes/robbyrussell.zsh-theme
@@ -1,5 +1,5 @@
-PROMPT="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
-PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
+PROMPT="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ ) %{$fg[cyan]%}%c%{$reset_color%}"
+PROMPT+=' $(git_prompt_info)'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "