42 lines
1.3 KiB
Plaintext
42 lines
1.3 KiB
Plaintext
|
# -*-mode: sh-*-
|
||
|
# My mess of various themes
|
||
|
|
||
|
setopt nopromptbang promptcr promptpercent promptsp promptsubst
|
||
|
|
||
|
if [[ $(locale charmap) != UTF-8 || "$TERM" == linux ]]
|
||
|
then
|
||
|
ERROR_CHAR='<'
|
||
|
DIRTY_CHAR='^'
|
||
|
STASH_CHAR='≡' # ASCII 240
|
||
|
PREFIX='$'
|
||
|
else
|
||
|
ERROR_CHAR='⏎'
|
||
|
DIRTY_CHAR="∆" # U+2206
|
||
|
STASH_CHAR='📚' # U+1F4DA
|
||
|
PREFIX='❱' # U+2771
|
||
|
fi
|
||
|
|
||
|
typeset -gA git_info
|
||
|
if (( ${+functions[git-info]} )); then
|
||
|
zstyle ':zim:git-info' verbose yes
|
||
|
zstyle ':zim:git-info:clean' format '%F{green}'
|
||
|
zstyle ':zim:git-info:branch' format '%b'
|
||
|
zstyle ':zim:git-info:commit' format '%c'
|
||
|
zstyle ':zim:git-info:action' format '%b%f:%F{yellow}%B%a'
|
||
|
zstyle ':zim:git-info:stashed' format "%S${STASH_CHAR}"
|
||
|
zstyle ':zim:git-info:dirty' format '%F{yellow}${DIRTY_CHAR}%f'
|
||
|
zstyle ':zim:git-info:keys' format \
|
||
|
'prompt' ' %F{yellow}%C%b%c%f%f%s' \
|
||
|
'rprompt' '%D%S'
|
||
|
|
||
|
autoload -Uz add-zsh-hook && add-zsh-hook precmd git-info
|
||
|
fi
|
||
|
|
||
|
# Define prompts.
|
||
|
local userHost='%B%(!.%F{red}.%F{green})%n@${SSH_CLIENT:+%F{blue\}}%m%f%b' # user@host
|
||
|
local pathString='%F{cyan}%$((($COLUMNS-20) / 4 ))<..<%~%f' # /path/to/wd
|
||
|
local gitInfo='${(e)git_info[prompt]}' # branch:action
|
||
|
local promptChar='%B%(!.%F{red}.%F{cyan})${PREFIX}%f%b'
|
||
|
PS1="$userHost $pathString$gitInfo$promptChar "
|
||
|
RPS1='${editor_info[overwrite]}%(?:: %F{red}%?'$ERROR_CHAR'%f) ${(e)git_info[rprompt]}'
|