theme: Rework zsh-git-prompt exception
This commit is contained in:
+42
-32
@@ -2,18 +2,29 @@
|
|||||||
|
|
||||||
typeset my_gray="$FG[240]"
|
typeset my_gray="$FG[240]"
|
||||||
|
|
||||||
# Primary prompt
|
# Optional widgets: zsh-git-prompt and virtualenv plugin may be missing.
|
||||||
if [ -z "${__GIT_PROMPT_DIR}" ]; then
|
if (( $+functions[git_super_status] )); then
|
||||||
PS1='$my_gray${(r:$COLUMNS::-:)}%{$reset_color%}
|
_vulporuza_git='$(git_super_status)'
|
||||||
╭ %T %{$FG[208]%}%~%{$reset_color%}$(git_prompt_info)
|
|
||||||
╰$(virtualenv_prompt_info) %(!.#.») '
|
|
||||||
else
|
else
|
||||||
PS1='$my_gray${(r:$COLUMNS::-:)}%{$reset_color%}
|
_vulporuza_git='$(git_prompt_info)'
|
||||||
╭ %T %{$FG[208]%}%~%{$reset_color%}$(git_super_status)
|
|
||||||
╰$(virtualenv_prompt_info) %(!.#.») '
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if (( $+functions[virtualenv_prompt_info] )); then
|
||||||
|
_vulporuza_venv='$(virtualenv_prompt_info)'
|
||||||
|
else
|
||||||
|
_vulporuza_venv=''
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Primary prompt
|
||||||
|
PS1='$my_gray${(r:$COLUMNS::-:)}%{$reset_color%}
|
||||||
|
╭ %T %{$FG[208]%}%~%{$reset_color%}'$_vulporuza_git'
|
||||||
|
╰'$_vulporuza_venv' %(!.#.») '
|
||||||
|
|
||||||
PS2='%{$fg[red]%}\ %{$reset_color%}'
|
PS2='%{$fg[red]%}\ %{$reset_color%}'
|
||||||
|
|
||||||
|
# Cleanup
|
||||||
|
unset _vulporuza_git _vulporuza_venv
|
||||||
|
|
||||||
# Right prompt
|
# Right prompt
|
||||||
RPS1='%(?..%{$fg[red]%}%? ↵%{$reset_color%}) $FG[245]%n@%m%{$reset_color%}'
|
RPS1='%(?..%{$fg[red]%}%? ↵%{$reset_color%}) $FG[245]%n@%m%{$reset_color%}'
|
||||||
|
|
||||||
@@ -25,37 +36,36 @@ ZSH_THEME_VIRTUALENV_SUFFIX=")%{$reset_color%}"
|
|||||||
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$reset_color%}["
|
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$reset_color%}["
|
||||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}]"
|
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}]"
|
||||||
|
|
||||||
if [ -z "${__GIT_PROMPT_DIR}" ]; then
|
if (( $+functions[git_super_status] )); then
|
||||||
# git settings
|
ZSH_THEME_GIT_PROMPT_HASH_PREFIX=":"
|
||||||
ZSH_THEME_GIT_PROMPT_CLEAN="%{$reset_color%}|%{$FG[034]%}✔"
|
ZSH_THEME_GIT_PROMPT_SEPARATOR="|"
|
||||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$reset_color%}|%{$FG[075]%}…"
|
ZSH_THEME_GIT_PROMPT_BRANCH="%{$fg_bold[magenta]%}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[red]%}%{●%1G%}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_CONFLICTS="%{$fg[red]%}%{✖%1G%}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_CHANGED="%{$fg[blue]%}%{✚%1G%}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_BEHIND="%{↓%1G%}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_AHEAD="%{↑%1G%}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_STASHED="%{$fg_bold[blue]%}%{⚑%1G%}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%}%{…%1G%}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}%{✔%1G%}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_LOCAL=" L"
|
||||||
|
# The remote branch will be shown between these two
|
||||||
|
ZSH_THEME_GIT_PROMPT_UPSTREAM_FRONT=" {%{$fg[blue]%}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_UPSTREAM_END="%{${reset_color}%}}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_MERGING="%{$fg_bold[magenta]%}|MERGING%{${reset_color}%}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_REBASE="%{$fg_bold[magenta]%}|REBASE%{${reset_color}%} "
|
||||||
|
ZSH_THEME_GIT_PROMPT_BISECT="%{$fg_bold[magenta]%}|BISECT%{${reset_color}%} "
|
||||||
else
|
else
|
||||||
ZSH_THEME_GIT_PROMPT_HASH_PREFIX=":"
|
ZSH_THEME_GIT_PROMPT_CLEAN="%{$reset_color%}|%{$FG[034]%}✔"
|
||||||
ZSH_THEME_GIT_PROMPT_SEPARATOR="|"
|
ZSH_THEME_GIT_PROMPT_DIRTY="%{$reset_color%}|%{$FG[075]%}…"
|
||||||
ZSH_THEME_GIT_PROMPT_BRANCH="%{$fg_bold[magenta]%}"
|
|
||||||
ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[red]%}%{●%1G%}"
|
|
||||||
ZSH_THEME_GIT_PROMPT_CONFLICTS="%{$fg[red]%}%{✖%1G%}"
|
|
||||||
ZSH_THEME_GIT_PROMPT_CHANGED="%{$fg[blue]%}%{✚%1G%}"
|
|
||||||
ZSH_THEME_GIT_PROMPT_BEHIND="%{↓%1G%}"
|
|
||||||
ZSH_THEME_GIT_PROMPT_AHEAD="%{↑%1G%}"
|
|
||||||
ZSH_THEME_GIT_PROMPT_STASHED="%{$fg_bold[blue]%}%{⚑%1G%}"
|
|
||||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%}%{…%1G%}"
|
|
||||||
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}%{✔%1G%}"
|
|
||||||
ZSH_THEME_GIT_PROMPT_LOCAL=" L"
|
|
||||||
# The remote branch will be shown between these two
|
|
||||||
ZSH_THEME_GIT_PROMPT_UPSTREAM_FRONT=" {%{$fg[blue]%}"
|
|
||||||
ZSH_THEME_GIT_PROMPT_UPSTREAM_END="%{${reset_color}%}}"
|
|
||||||
ZSH_THEME_GIT_PROMPT_MERGING="%{$fg_bold[magenta]%}|MERGING%{${reset_color}%}"
|
|
||||||
ZSH_THEME_GIT_PROMPT_REBASE="%{$fg_bold[magenta]%}|REBASE%{${reset_color}%} "
|
|
||||||
ZSH_THEME_GIT_PROMPT_BISECT="%{$fg_bold[magenta]%}|BISECT%{${reset_color}%} "
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
function theme_preexec {
|
function theme_preexec {
|
||||||
print -nr $'\e]2;'"$USER@$HOST » $PWD » $1"$'\a'
|
print -nr $'\e]2;'"$USER@$HOST » $PWD » $1"$'\a'
|
||||||
}
|
}
|
||||||
add-zsh-hook preexec theme_preexec
|
add-zsh-hook preexec theme_preexec
|
||||||
|
|
||||||
function theme_precmd {
|
function theme_precmd {
|
||||||
print -nr $'\e]2;'"$USER@$HOST » $PWD"$'\a'
|
print -nr $'\e]2;'"$USER@$HOST » $PWD"$'\a'
|
||||||
}
|
}
|
||||||
add-zsh-hook precmd theme_precmd
|
add-zsh-hook precmd theme_precmd
|
||||||
|
|||||||
Reference in New Issue
Block a user