Merge remote-tracking branch 'upstream/master'

* upstream/master: (237 commits)
  feat(z): update to version afaf2965 (#12136)
  feat(gitfast): update to version v2.0 (#12135)
  ci(project): use ohmyzsh's bot credentials
  ci(dependencies): fix some envs and add requirements
  feat(git): add `gcB` alias (#12116)
  feat(aws): add support for sso sessions login (#12090)
  feat(aws): add sso logout capabilities (#12113)
  fix(bgnotify): don't require accessibility perms in macos (#11433)
  fix(nvm): prevent duplicates in lazy_cmd
  feat(react-native): add aliases for iPhone 15 (#12114)
  fix(bgnotify): make it work with `set -e` (#12111)
  fix(changelog): use longer hashes for commits (#12096)
  fix(rake-fast): make `.rake_tasks` write atomic (#12108)
  ci(dependencies): fix typo
  ci(dependencies): add automation for updating external dependencies (#12109)
  feat(dotnet): update completion script (#12028)
  feat(frontend-search): add `I am lucky` option
  feat(frontend-search): add nextjs
  fix(lib): patch `omz_urlencode` to not encode UTF-8 chars in Termux (#12076)
  feat(bgnotify): add option to disable terminal bell (#12077)
  ...

# Conflicts:
#	README.md
This commit is contained in:
Fred Klassen 2023-12-29 10:17:05 -08:00
commit c876a57173
No known key found for this signature in database
GPG key ID: E9E2149793BDE17E
181 changed files with 3830 additions and 1615 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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`') '
}

View file

@ -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'

View file

@ -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

View file

@ -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%} "

View file

@ -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%}"
}

View file

@ -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]%}"

View file

@ -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 '

View file

@ -1,7 +1,7 @@
PROMPT="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
PROMPT="%(?:%{$fg_bold[green]%}%1{➜%} :%{$fg_bold[red]%}%1{➜%} ) %{$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%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}%1{✗%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"