Update 13.05.2022

This commit is contained in:
2022-05-13 22:49:55 +05:00
parent 04423b8c5c
commit b40b4515e3
126 changed files with 2457 additions and 6430 deletions

View File

@@ -2,27 +2,23 @@ function toon {
echo -n ""
}
get_git_dirty() {
git diff --quiet || echo '*'
}
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{5}[%F{2}%b%F{3}|%F{1}%a%c%u%F{5}]%f '
zstyle ':vcs_info:*' formats \
'%F{5}%F{5}[%F{2}%b%c%u%F{5}]%f '
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
zstyle ':vcs_info:*' actionformats '%F{5}[%F{2}%b%F{3}|%F{1}%a%c%u%F{5}]%f '
zstyle ':vcs_info:*' formats '%F{5}[%F{2}%b%c%u%F{5}]%f '
zstyle ':vcs_info:svn:*' branchformat '%b'
zstyle ':vcs_info:svn:*' actionformats '%F{5}[%F{2}%b%F{1}:%F{3}%i%F{3}|%F{1}%a%c%u%F{5}]%f '
zstyle ':vcs_info:svn:*' formats '%F{5}[%F{2}%b%F{1}:%F{3}%i%c%u%F{5}]%f '
zstyle ':vcs_info:*' enable git cvs svn
theme_precmd () {
vcs_info
vcs_info
}
setopt prompt_subst
PROMPT='%{$fg[magenta]%}$(toon)%{$reset_color%} %~/ %{$reset_color%}${vcs_info_msg_0_}%{$reset_color%}'
autoload -U add-zsh-hook
add-zsh-hook precmd theme_precmd
add-zsh-hook precmd theme_precmd

View File

@@ -16,7 +16,7 @@ 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%}"
bureau_git_branch () {
bureau_git_info () {
local ref
ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return
@@ -25,20 +25,21 @@ bureau_git_branch () {
bureau_git_status() {
local result gitstatus
gitstatus="$(command git status --porcelain -b 2>/dev/null)"
# check status of files
gitstatus=$(command git status --porcelain -b 2> /dev/null)
if [[ -n "$gitstatus" ]]; then
if $(echo "$gitstatus" | command grep -q '^[AMRD]. '); then
local gitfiles="$(tail -n +2 <<< "$gitstatus")"
if [[ -n "$gitfiles" ]]; then
if [[ "$gitfiles" =~ $'(^|\n)[AMRD]. ' ]]; then
result+="$ZSH_THEME_GIT_PROMPT_STAGED"
fi
if $(echo "$gitstatus" | command grep -q '^.[MTD] '); then
if [[ "$gitfiles" =~ $'(^|\n).[MTD] ' ]]; then
result+="$ZSH_THEME_GIT_PROMPT_UNSTAGED"
fi
if $(echo "$gitstatus" | command grep -q -E '^\?\? '); then
if [[ "$gitfiles" =~ $'(^|\n)\\?\\? ' ]]; then
result+="$ZSH_THEME_GIT_PROMPT_UNTRACKED"
fi
if $(echo "$gitstatus" | command grep -q '^UU '); then
if [[ "$gitfiles" =~ $'(^|\n)UU ' ]]; then
result+="$ZSH_THEME_GIT_PROMPT_UNMERGED"
fi
else
@@ -46,17 +47,19 @@ bureau_git_status() {
fi
# check status of local repository
if $(echo "$gitstatus" | command grep -q '^## .*ahead'); then
local gitbranch="$(head -n 1 <<< "$gitstatus")"
if [[ "$gitbranch" =~ '^## .*ahead' ]]; then
result+="$ZSH_THEME_GIT_PROMPT_AHEAD"
fi
if $(echo "$gitstatus" | command grep -q '^## .*behind'); then
if [[ "$gitbranch" =~ '^## .*behind' ]]; then
result+="$ZSH_THEME_GIT_PROMPT_BEHIND"
fi
if $(echo "$gitstatus" | command grep -q '^## .*diverged'); then
if [[ "$gitbranch" =~ '^## .*diverged' ]]; then
result+="$ZSH_THEME_GIT_PROMPT_DIVERGED"
fi
if $(command git rev-parse --verify refs/stash &> /dev/null); then
# check if there are stashed changes
if command git rev-parse --verify refs/stash &> /dev/null; then
result+="$ZSH_THEME_GIT_PROMPT_STASHED"
fi
@@ -64,21 +67,22 @@ bureau_git_status() {
}
bureau_git_prompt() {
local gitbranch=$(bureau_git_branch)
local gitstatus=$(bureau_git_status)
local info
if [[ -z "$gitbranch" ]]; then
# check git information
local gitinfo=$(bureau_git_info)
if [[ -z "$gitinfo" ]]; then
return
fi
info="${gitbranch:gs/%/%%}"
# quote % in git information
local output="${gitinfo:gs/%/%%}"
# check git status
local gitstatus=$(bureau_git_status)
if [[ -n "$gitstatus" ]]; then
info+=" $gitstatus"
output+=" $gitstatus"
fi
echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${info}${ZSH_THEME_GIT_PROMPT_SUFFIX}"
echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${output}${ZSH_THEME_GIT_PROMPT_SUFFIX}"
}
@@ -99,19 +103,14 @@ get_space () {
local STR=$1$2
local zero='%([BSUbfksu]|([FB]|){*})'
local LENGTH=${#${(S%%)STR//$~zero/}}
local SPACES=""
(( LENGTH = ${COLUMNS} - $LENGTH - 1))
local SPACES=$(( COLUMNS - LENGTH - ${ZLE_RPROMPT_INDENT:-1} ))
for i in {0..$LENGTH}
do
SPACES="$SPACES "
done
echo $SPACES
(( SPACES > 0 )) || return
printf ' %.0s' {1..$SPACES}
}
_1LEFT="$_USERNAME $_PATH"
_1RIGHT="[%*] "
_1RIGHT="[%*]"
bureau_precmd () {
_1SPACES=`get_space $_1LEFT $_1RIGHT`

View File

@@ -46,6 +46,16 @@
# is shown (see vcs_action_glyph variable, default: chevron).
# ------------------------------------------------------------------------------
(( ${+functions[emotty]} )) || {
echo "error: the emotty theme requires the emotty plugin" >&2
return 1
}
(( ${+emoji} )) || {
echo "error: the emotty theme requires the emoji plugin" >&2
return 1
}
user_prompt="$(emotty)"
root_prompt="$emoji[skull]"
warn_prompt="$emoji[collision_symbol]"

View File

@@ -2,7 +2,7 @@ PROMPT=$'
%{$fg[blue]%}%/%{$reset_color%} $(git_prompt_info)$(bzr_prompt_info)%{$fg[white]%}[%n@%m]%{$reset_color%} %{$fg[white]%}[%T]%{$reset_color%}
%{$fg_bold[black]%}>%{$reset_color%} '
PROMPT2="%{$fg_blod[black]%}%_> %{$reset_color%}"
PROMPT2="%{$fg_bold[black]%}%_> %{$reset_color%}"
GIT_CB="git::"
ZSH_THEME_SCM_PROMPT_PREFIX="%{$fg[green]%}["

View File

@@ -6,7 +6,9 @@ zstyle ':vcs_info:*' unstagedstr '%F{red}*' # display this when there are unst
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:svn:*' branchformat '%b'
zstyle ':vcs_info:svn:*' actionformats '%F{5}(%F{2}%b%F{1}:%{3}%i%F{3}|%F{1}%a%c%u%m%F{5})%f '
zstyle ':vcs_info:svn:*' formats '%F{5}(%F{2}%b%F{1}:%F{3}%i%c%u%m%F{5})%f '
zstyle ':vcs_info:*' enable git cvs svn
zstyle ':vcs_info:git*+set-message:*' hooks untracked-git

View File

@@ -4,7 +4,6 @@ autoload -Uz vcs_info
zstyle ':vcs_info:*' actionformats \
'%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f '
zstyle ':vcs_info:*' formats '%F{2}%s%F{7}:%F{2}(%F{1}%b%F{2})%f '
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
zstyle ':vcs_info:*' enable git
add-zsh-hook precmd prompt_vcs

View File

@@ -3,16 +3,18 @@ autoload -Uz vcs_info
zstyle ':vcs_info:*' stagedstr '%F{green}●'
zstyle ':vcs_info:*' unstagedstr '%F{yellow}●'
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r'
zstyle ':vcs_info:svn:*' branchformat '%b'
zstyle ':vcs_info:svn:*' formats ' [%b%F{1}:%F{11}%i%c%u%B%F{green}]'
zstyle ':vcs_info:*' enable git svn
theme_precmd () {
if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] {
zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{green}]'
} else {
zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{red}●%F{green}]'
}
vcs_info
theme_precmd () {
if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
zstyle ':vcs_info:git:*' formats ' [%b%c%u%B%F{green}]'
else
zstyle ':vcs_info:git:*' formats ' [%b%c%u%B%F{red}●%F{green}]'
fi
vcs_info
}
setopt prompt_subst

View File

@@ -28,7 +28,6 @@ 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 \
"%{$c8%}%s%{$c7%}:%{$c7%}(%{$c9%}%b%{$c7%})%f "
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
zstyle ':vcs_info:*' enable git
add-zsh-hook precmd prompt_jnrowe_precmd

View File

@@ -35,23 +35,17 @@ local reset="%{$reset_color%}"
local -a color_array
color_array=($green $red $cyan $yellow $blue $magenta $white)
local username_normal_color=$white
local username_root_color=$red
local hostname_root_color=$red
# calculating hostname color with hostname characters
for i in `hostname`; local hostname_normal_color=$color_array[$[((#i))%7+1]]
local -a hostname_color
hostname_color=%(!.$hostname_root_color.$hostname_normal_color)
local username_color=$white
local hostname_color=$color_array[$[((#HOST))%7+1]] # choose hostname color based on first character
local current_dir_color=$blue
local username_command="%n"
local hostname_command="%m"
local username="%n"
local hostname="%m"
local current_dir="%~"
local username_output="%(!..$username_normal_color$username_command$reset@)"
local hostname_output="$hostname_color$hostname_command$reset"
local current_dir_output="$current_dir_color$current_dir$reset"
local username_output="%(!..${username_color}${username}${reset}@)"
local hostname_output="${hostname_color}${hostname}${reset}"
local current_dir_output="${current_dir_color}${current_dir}${reset}"
local jobs_bg="${red}fg: %j$reset"
local last_command_output="%(?.%(!.$red.$green).$yellow)"
@@ -68,8 +62,18 @@ ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE=">"
ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE="<"
ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE="$red<>"
PROMPT='$username_output$hostname_output:$current_dir_output%1(j. [$jobs_bg].)'
GIT_PROMPT='$(out=$(git_prompt_info)$(git_prompt_status)$(git_remote_status);if [[ -n $out ]]; then printf %s " $white($green$out$white)$reset";fi)'
PROMPT+="$GIT_PROMPT"
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[green]%}" \
"$out" \
"%{$fg_bold[white]%}" \
"%{$reset_color%}"
}
PROMPT="$username_output$hostname_output:$current_dir_output%1(j. [$jobs_bg].)"
PROMPT+='$(michelebologna_git_prompt)'
PROMPT+=" $last_command_output%#$reset "
RPROMPT=''

View File

@@ -30,6 +30,6 @@ function mygit() {
function retcode() {}
# alternate prompt with git & hg
PROMPT=$'%{$fg_bold[blue]%}┌─[%{$fg_bold[green]%}%n%b%{$fg[black]%}@%{$fg[cyan]%}%m%{$fg_bold[blue]%}]%{$reset_color%} - %{$fg_bold[blue]%}[%{$fg_bold[white]%}%~%{$fg_bold[blue]%}]%{$reset_color%} - %{$fg_bold[blue]%}[%b%{$fg[yellow]%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{$fg_bold[blue]%}]
PROMPT=$'%{$fg_bold[blue]%}┌─[%{$fg_bold[green]%}%n%b%{$fg[black]%}@%{$fg[cyan]%}%m%{$fg_bold[blue]%}]%{$reset_color%} - %{$fg_bold[blue]%}[%{$fg_bold[default]%}%~%{$fg_bold[blue]%}]%{$reset_color%} - %{$fg_bold[blue]%}[%b%{$fg[yellow]%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{$fg_bold[blue]%}]
%{$fg_bold[blue]%}└─[%{$fg_bold[magenta]%}%?$(retcode)%{$fg_bold[blue]%}] <$(mygit)$(hg_prompt_info)>%{$reset_color%} '
PS2=$' \e[0;34m%}%B>%{\e[0m%}%b '

View File

@@ -102,7 +102,6 @@ zstyle ':vcs_info:*' actionformats \
zstyle ':vcs_info:*' formats \
"%{$c8%}%s%%{$c7%} %{$c9%}%{$c11%}%b%{$c7%} %{$reset_color%}%f "
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
zstyle ':vcs_info:*' enable git
add-zsh-hook precmd prompt_jnrowe_precmd

View File

@@ -49,7 +49,7 @@ 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
[[ -n "${VIRTUAL_ENV:-}" ]] || return
echo "${YS_THEME_VIRTUALENV_PROMPT_PREFIX}${VIRTUAL_ENV:t}${YS_THEME_VIRTUALENV_PROMPT_SUFFIX}"
}

View File

@@ -3,16 +3,18 @@ autoload -Uz vcs_info
zstyle ':vcs_info:*' stagedstr '%F{green}●'
zstyle ':vcs_info:*' unstagedstr '%F{yellow}●'
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r'
zstyle ':vcs_info:svn:*' branchformat '%b'
zstyle ':vcs_info:svn:*' formats ' [%b%F{1}:%F{11}%i%c%u%B%F{green}]'
zstyle ':vcs_info:*' enable git svn
theme_precmd () {
if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] {
zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{green}]'
} else {
zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{red}●%F{green}]'
}
vcs_info
theme_precmd () {
if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
zstyle ':vcs_info:git:*' formats ' [%b%c%u%B%F{green}]'
else
zstyle ':vcs_info:git:*' formats ' [%b%c%u%B%F{red}●%F{green}]'
fi
vcs_info
}
setopt prompt_subst