Update giddie theme
Signed-off-by: Sorin Ionescu <sorin.ionescu@gmail.com>
This commit is contained in:
parent
13ed3a1bf7
commit
567506f7e7
@ -6,7 +6,7 @@
|
|||||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||||
#
|
#
|
||||||
# Features:
|
# Features:
|
||||||
# - Simple VCS branch, staged and unstaged indication.
|
# - Simple VCS branch, staged, and unstaged indication.
|
||||||
# - Prompt character is different in a VCS repository.
|
# - Prompt character is different in a VCS repository.
|
||||||
# - Last command exit status is displayed when non-zero.
|
# - Last command exit status is displayed when non-zero.
|
||||||
#
|
#
|
||||||
@ -14,24 +14,25 @@
|
|||||||
# http://i.imgur.com/rCo3S.png
|
# http://i.imgur.com/rCo3S.png
|
||||||
#
|
#
|
||||||
|
|
||||||
function +vi-git-status() {
|
function +vi-set_novcs_prompt_symbol {
|
||||||
# Check for untracked files or updated submodules since vcs_info does not.
|
_prompt_giddie_symbol=')'
|
||||||
|
}
|
||||||
|
|
||||||
|
function +vi-set_vcs_prompt_symbol {
|
||||||
|
_prompt_giddie_symbol='±'
|
||||||
|
}
|
||||||
|
|
||||||
|
function +vi-git_precmd {
|
||||||
|
# Check for untracked files, since vcs_info does not.
|
||||||
if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
|
if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
|
||||||
hook_com[unstaged]='%F{green}!%f'
|
hook_com[unstaged]+='%F{green}?%f'
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function prompt_giddie_precmd {
|
function prompt_giddie_precmd {
|
||||||
# Replace '/home/<user>' with '~'.
|
# Replace '/home/<user>' with '~'.
|
||||||
_prompt_giddie_pwd="${PWD/#$HOME/~}"
|
_prompt_giddie_pwd="${PWD/#$HOME/~}"
|
||||||
|
vcs_info
|
||||||
# Choose prompt symbol based on whether or not we are in a repository.
|
|
||||||
if (( $+commands[git] )) && git rev-parse 2> /dev/null; then
|
|
||||||
_prompt_giddie_symbol='±'
|
|
||||||
vcs_info
|
|
||||||
else
|
|
||||||
_prompt_giddie_symbol=')'
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function prompt_giddie_setup {
|
function prompt_giddie_setup {
|
||||||
@ -48,23 +49,28 @@ function prompt_giddie_setup {
|
|||||||
|
|
||||||
# Set editor-info parameters.
|
# Set editor-info parameters.
|
||||||
zstyle ':prezto:module:editor:info:completing' format '%F{green}...%f'
|
zstyle ':prezto:module:editor:info:completing' format '%F{green}...%f'
|
||||||
|
zstyle ':prezto:module:editor:info:keymap:alternate' format '%F{yellow}--- COMMAND ---%f'
|
||||||
|
|
||||||
# Set vcs_info parameters.
|
# Set vcs_info parameters.
|
||||||
zstyle ':vcs_info:*' enable git
|
|
||||||
zstyle ':vcs_info:*' check-for-changes true
|
zstyle ':vcs_info:*' check-for-changes true
|
||||||
zstyle ':vcs_info:*' formats ' on %F{magenta}%b%f%c%u'
|
zstyle ':vcs_info:*' formats ' on %F{magenta}%b%f%c%u'
|
||||||
zstyle ':vcs_info:*' actionformats ' on %F{magenta}%b%f%c%u %F{yellow}(%a)%f'
|
zstyle ':vcs_info:*' actionformats ' on %F{magenta}%b%f%c%u %F{yellow}(%a)%f'
|
||||||
zstyle ':vcs_info:*' stagedstr '%F{green}+%f'
|
zstyle ':vcs_info:*' stagedstr '%F{green}+%f'
|
||||||
zstyle ':vcs_info:*' unstagedstr '%F{green}!%f'
|
zstyle ':vcs_info:*' unstagedstr '%F{green}!%f'
|
||||||
zstyle ':vcs_info:git*+set-message:*' hooks git-status
|
|
||||||
|
# Set vcs_info hooks.
|
||||||
|
# NOTE: Prior to Zsh v4.3.12, there are no static hooks, no vcs_info_hookadd
|
||||||
|
# function, and no 'no-vcs' hook.
|
||||||
|
zstyle ':vcs_info:*+start-up:*' hooks set_novcs_prompt_symbol
|
||||||
|
zstyle ':vcs_info:git*+set-message:*' hooks set_vcs_prompt_symbol git_precmd
|
||||||
|
zstyle ':vcs_info:*+set-message:*' hooks set_vcs_prompt_symbol
|
||||||
|
|
||||||
# Define prompts.
|
# Define prompts.
|
||||||
PROMPT='%(?..%F{red}%B-> [%?]%b%f
|
PROMPT='%(?..%F{red}%B-> [%?]%b%f
|
||||||
)%F{magenta}%n%f@%F{yellow}%m%f|%F{green}${_prompt_giddie_pwd}%f${vcs_info_msg_0_}
|
)%F{magenta}%n%f@%F{yellow}%m%f|%F{green}${_prompt_giddie_pwd}%f${vcs_info_msg_0_}
|
||||||
%F{blue}${_prompt_giddie_symbol}%f '
|
%F{blue}${_prompt_giddie_symbol}%f '
|
||||||
RPROMPT=''
|
RPROMPT='${editor_info[keymap]}'
|
||||||
SPROMPT='zsh: correct %F{magenta}%R%f to %F{green}%r%f [nyae]? '
|
SPROMPT='zsh: correct %F{magenta}%R%f to %F{green}%r%f [nyae]? '
|
||||||
}
|
}
|
||||||
|
|
||||||
prompt_giddie_setup "$@"
|
prompt_giddie_setup "$@"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user