[zsh] A bit of internal prompt cleanup
This commit is contained in:
parent
1f1fa8a5d1
commit
a9848d6149
1 changed files with 13 additions and 13 deletions
22
prompt
22
prompt
|
@ -14,9 +14,9 @@ color_username () {
|
||||||
|
|
||||||
color_prompt_char () {
|
color_prompt_char () {
|
||||||
if [[ $EUID -eq 0 ]]; then
|
if [[ $EUID -eq 0 ]]; then
|
||||||
echo "%{$fg_no_bold[red]%}#%{$reset_color%}"
|
echo "%{$fg_no_bold[red]%G#$reset_color%}"
|
||||||
else
|
else
|
||||||
echo "%{$fg_no_bold[blue]%}$%{$reset_color%}"
|
echo "%{$fg_no_bold[blue]%G\$$reset_color%}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ last_status () {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual_env() {
|
virtual_env() {
|
||||||
local prefix="%{$fg_bold[green]%}(%{%b$fg[green]%}"
|
local prefix="%{$fg_bold[green]%}(%{%b%}"
|
||||||
local suffix="%{$reset_color$fg_bold[green]%})%{$reset_color%}"
|
local suffix="%{$reset_color$fg_bold[green]%})%{$reset_color%}"
|
||||||
[[ -n ${VIRTUAL_ENV} ]] || return
|
[[ -n ${VIRTUAL_ENV} ]] || return
|
||||||
printf '%s' "${prefix}${VIRTUAL_ENV:t}${suffix}"
|
printf '%s' "${prefix}${VIRTUAL_ENV:t}${suffix}"
|
||||||
|
@ -54,7 +54,7 @@ virtual_env() {
|
||||||
prompt_chars() {
|
prompt_chars() {
|
||||||
local git_char=''
|
local git_char=''
|
||||||
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
|
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
|
||||||
local git_char="%{$fg_no_bold[blue]%}±%{$reset_color%}"
|
local git_char="%{$fg_no_bold[blue]%G±$reset_color%}"
|
||||||
fi
|
fi
|
||||||
printf '%s' "$(last_status) $(color_prompt_char)"
|
printf '%s' "$(last_status) $(color_prompt_char)"
|
||||||
}
|
}
|
||||||
|
@ -129,24 +129,24 @@ vim_mode () {
|
||||||
# %S - path in the repository
|
# %S - path in the repository
|
||||||
# %a - action (e.g. rebase-i)
|
# %a - action (e.g. rebase-i)
|
||||||
# %b - branchname
|
# %b - branchname
|
||||||
# %c - stangedstr (see below)
|
# %c - stagedstr (see below)
|
||||||
# %i - The current revision number or identifier.
|
# %i - The current revision number or identifier.
|
||||||
# %m - Misc. In case of Git, show information about stashes
|
# %m - Misc. In case of Git, show information about stashes
|
||||||
# %r - The name of the root directory of the repository
|
# %r - The name of the root directory of the repository
|
||||||
# %s - The current version control system, like git or svn
|
# %s - The current version control system, like git or svn
|
||||||
# %u - unstagedstr (see below)
|
# %u - unstagedstr (see below)
|
||||||
fmt_branch="%b%{$reset_color%}%u%c%m%{$reset_color%}" # e.g. master¹²
|
fmt_branch="%b%{$reset_color%}%u%c%m%{$reset_color%}" # e.g. master¹²
|
||||||
fmt_action="(%{$fg[red]%}%a%{$reset_color%})" # e.g. (rebase-i)
|
fmt_action="%{$fg[red]%}%a%{$reset_color%}" # e.g. (rebase-i)
|
||||||
fmt_pre="%{$fg_bold[blue]%}[%{$reset_color%}%{$fg[blue]%}"
|
fmt_pre="%{$fg_bold[blue]%G[$reset_color$fg[blue]%}"
|
||||||
fmt_post="%{$fg_bold[blue]%}]%{$reset_color%}"
|
fmt_post="%{$fg_bold[blue]%G]$reset_color%}"
|
||||||
|
|
||||||
# check-for-changes can be really slow.
|
# check-for-changes can be really slow.
|
||||||
# you should disable it, if you work with large repositories
|
# you should disable it, if you work with large repositories
|
||||||
zstyle ':vcs_info:*' enable git cvs svn
|
zstyle ':vcs_info:*' enable git cvs svn
|
||||||
zstyle ':vcs_info:*' check-for-changes true
|
zstyle ':vcs_info:*' check-for-changes true
|
||||||
zstyle ':vcs_info:*' unstagedstr "%{$fg_no_bold[yellow]%G●%}"
|
zstyle ':vcs_info:*' unstagedstr "%{$fg_no_bold[yellow]%G●%}"
|
||||||
zstyle ':vcs_info:*' stagedstr "%{$fg_no_bold[green]%}%G●%}"
|
zstyle ':vcs_info:*' stagedstr "%{$fg_no_bold[green]%G●%}"
|
||||||
zstyle ':vcs_info:*' actionformats "${fmt_pre}${fmt_branch}${fmt_action}${fmt_post} "
|
zstyle ':vcs_info:*' actionformats "${fmt_pre}${fmt_branch}|${fmt_action}${fmt_post}"
|
||||||
zstyle ':vcs_info:*' formats "${fmt_pre}${fmt_branch}${fmt_post}"
|
zstyle ':vcs_info:*' formats "${fmt_pre}${fmt_branch}${fmt_post}"
|
||||||
zstyle ':vcs_info:*' nvcsformats ""
|
zstyle ':vcs_info:*' nvcsformats ""
|
||||||
zstyle ':vcs_info:*+*:*' debug false # Set to true to see which hooks are being run
|
zstyle ':vcs_info:*+*:*' debug false # Set to true to see which hooks are being run
|
||||||
|
@ -215,7 +215,7 @@ prompt_create zle-line-init zle-keymap-select () {
|
||||||
PROMPT+="$(virtual_env)$(prompt_chars) %{$reset_color%}"
|
PROMPT+="$(virtual_env)$(prompt_chars) %{$reset_color%}"
|
||||||
|
|
||||||
# Right prompt with current repo informations
|
# Right prompt with current repo informations
|
||||||
RPROMPT="${vcs_info_msg_0_}%{$reset_color%}%E"
|
RPROMPT="${vcs_info_msg_0_}%E"
|
||||||
|
|
||||||
zle reset-prompt
|
zle reset-prompt
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue