63 lines
2.2 KiB
Bash
63 lines
2.2 KiB
Bash
SEGMENT_DATE="%K{249}%F{black} %* %k%f"
|
|
|
|
if [ $(id -u) -eq 0 ]; then
|
|
SEGMENT_USERNAME_BG=%K{red}
|
|
SEGMENT_USERNAME_FG=%F{white}
|
|
USER_PROMPT="%K{red}%F{011}|%# %f%k"
|
|
else
|
|
SEGMENT_USERNAME_BG=%K{031}
|
|
SEGMENT_USERNAME_FG=%F{white}
|
|
USER_PROMPT="%F{245}|%# %f%k"
|
|
fi
|
|
|
|
#SEGMENT_HOSTNAME_BG=%K{020}
|
|
#SEGMENT_HOSTNAME_FG=%F{011}
|
|
SEGMENT_HOSTNAME_BG=%K{202}
|
|
SEGMENT_HOSTNAME_FG=%F{011}
|
|
if [ "$SEGMENT_DETECT_SSH" != "" ]; then
|
|
if [ -n "$SSH_CLIENT" ]; then
|
|
SEGMENT_HOSTNAME_BG=%K{202}
|
|
SEGMENT_HOSTNAME_FG=%F{011}
|
|
fi
|
|
fi
|
|
|
|
SEGMENT_RESULT="%B%(?.%K{green}%F{black} OK.%K{red}%F{011} RETURN %?) %f%k%b"
|
|
SEGMENT_HOSTNAME="${SEGMENT_HOSTNAME_BG}${SEGMENT_HOSTNAME_FG} @%m %k%f"
|
|
SEGMENT_USER_NAME="${SEGMENT_USERNAME_FG}${SEGMENT_USERNAME_BG} %B%n%b %k"
|
|
SEGMENT_CURRENT_PATH="%K{242}%F{white} %~ %k%f"
|
|
|
|
ZSH_THEME_GIT_PROMPT_DIRTY="%F{red}[Dirty]%F{black}"
|
|
ZSH_THEME_GIT_PROMPT_CLEAN="%F{green}[Clean]%F{black}"
|
|
ZSH_THEME_GIT_PROMPT_ADDED="%F{green}[Added]%F{black}"
|
|
ZSH_THEME_GIT_PROMPT_MODIFIED="%F{blue}[Modified]%F{black}"
|
|
ZSH_THEME_GIT_PROMPT_DELETED="%F{red}[Deleted]%F{black}"
|
|
ZSH_THEME_GIT_PROMPT_UNTRACKED="%F{yellow}[Untracked]%F{black}"
|
|
ZSH_THEME_GIT_PROMPT_RENAMED="%F{blue}[Renamed]%F{black}"
|
|
ZSH_THEME_GIT_PROMPT_UNMERGED="%F{orange}[Unmerged]%F{black}"
|
|
ZSH_THEME_GIT_PROMPT_AHEAD="%F{orange}[Ahead]%F{black}"
|
|
ZSH_THEME_GIT_PROMPT_BEHIND="%F{orange}[Behind]%F{black}"
|
|
ZSH_THEME_GIT_PROMPT_DIVERGED="%F{orange}[Diverged]%F{black}"
|
|
|
|
SEGMENT_GIT_INFO_LEFT="\$(git_prompt_status)"
|
|
if [ $SEGMENT_GIT_INFO_LEFT ]; then
|
|
SEGMENT_GIT_INFO_LEFT="%F{249} $SEGMENT_GIT_INFO_LEFT %k%f"
|
|
fi
|
|
SEGMENT_GIT_INFO_RIGHT="${vcs_info_msg_0_}"
|
|
|
|
zstyle ':vcs_info:*' formats "(%s)-[%b]%u%c"
|
|
|
|
ALL_SEGMENTS="${SEGMENT_HOSTNAME}${SEGMENT_USER_NAME}${SEGMENT_CURRENT_PATH}${SEGMENT_GIT_INFO_LEFT}
|
|
${USER_PROMPT}"
|
|
|
|
_lineup=$'\e[1A'
|
|
_linedown=$'\e[1B'
|
|
|
|
RPROMPT="%{${_lineup}%}${SEGMENT_GIT_INFO_RIGHT}${SEGMENT_DATE}${SEGMENT_RESULT}%{${_linedown}%}"
|
|
|
|
function zle-line-init zle-keymap-select {
|
|
PROMPT="%B"${${KEYMAP/vicmd/%F{022}%K{white} NORMAL %k%f}/(main|viins)/%F{022}%K{154} INSERT %f%k}"%b${ALL_SEGMENTS}"
|
|
zle reset-prompt
|
|
}
|
|
|
|
zle -N zle-line-init
|
|
zle -N zle-keymap-select
|