mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-11 00:10:08 +00:00
commit
533e31f2cc
1 changed files with 36 additions and 23 deletions
|
@ -71,17 +71,30 @@ setprompt () {
|
|||
|
||||
###
|
||||
# See if we can use extended characters to look nicer.
|
||||
# UTF-8 Fixed
|
||||
|
||||
typeset -A altchar
|
||||
set -A altchar ${(s..)terminfo[acsc]}
|
||||
PR_SET_CHARSET="%{$terminfo[enacs]%}"
|
||||
PR_SHIFT_IN="%{$terminfo[smacs]%}"
|
||||
PR_SHIFT_OUT="%{$terminfo[rmacs]%}"
|
||||
PR_HBAR=${altchar[q]:--}
|
||||
PR_ULCORNER=${altchar[l]:--}
|
||||
PR_LLCORNER=${altchar[m]:--}
|
||||
PR_LRCORNER=${altchar[j]:--}
|
||||
PR_URCORNER=${altchar[k]:--}
|
||||
if [[ $(locale charmap) == "UTF-8" ]]; then
|
||||
PR_SET_CHARSET=""
|
||||
PR_SHIFT_IN=""
|
||||
PR_SHIFT_OUT=""
|
||||
PR_HBAR="─"
|
||||
PR_ULCORNER="┌"
|
||||
PR_LLCORNER="└"
|
||||
PR_LRCORNER="┘"
|
||||
PR_URCORNER="┐"
|
||||
else
|
||||
typeset -A altchar
|
||||
set -A altchar ${(s..)terminfo[acsc]}
|
||||
# Some stuff to help us draw nice lines
|
||||
PR_SET_CHARSET="%{$terminfo[enacs]%}"
|
||||
PR_SHIFT_IN="%{$terminfo[smacs]%}"
|
||||
PR_SHIFT_OUT="%{$terminfo[rmacs]%}"
|
||||
PR_HBAR='$PR_SHIFT_IN${altchar[q]:--}$PR_SHIFT_OUT'
|
||||
PR_ULCORNER='$PR_SHIFT_IN${altchar[l]:--}$PR_SHIFT_OUT'
|
||||
PR_LLCORNER='$PR_SHIFT_IN${altchar[m]:--}$PR_SHIFT_OUT'
|
||||
PR_LRCORNER='$PR_SHIFT_IN${altchar[j]:--}$PR_SHIFT_OUT'
|
||||
PR_URCORNER='$PR_SHIFT_IN${altchar[k]:--}$PR_SHIFT_OUT'
|
||||
fi
|
||||
|
||||
|
||||
###
|
||||
|
@ -113,31 +126,31 @@ setprompt () {
|
|||
# Finally, the prompt.
|
||||
|
||||
PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\
|
||||
$PR_CYAN$PR_SHIFT_IN$PR_ULCORNER$PR_HBAR$PR_SHIFT_OUT$PR_GREY(\
|
||||
$PR_CYAN$PR_ULCORNER$PR_HBAR$PR_GREY(\
|
||||
$PR_GREEN%$PR_PWDLEN<...<%~%<<\
|
||||
$PR_GREY)`rvm_prompt_info || rbenv_prompt_info`$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_HBAR${(e)PR_FILLBAR}$PR_HBAR$PR_SHIFT_OUT$PR_GREY(\
|
||||
$PR_GREY)`rvm_prompt_info || rbenv_prompt_info`$PR_CYAN$PR_HBAR$PR_HBAR${(e)PR_FILLBAR}$PR_HBAR$PR_GREY(\
|
||||
$PR_CYAN%(!.%SROOT%s.%n)$PR_GREY@$PR_GREEN%m:%l\
|
||||
$PR_GREY)$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_URCORNER$PR_SHIFT_OUT\
|
||||
$PR_GREY)$PR_CYAN$PR_HBAR$PR_URCORNER\
|
||||
|
||||
$PR_CYAN$PR_SHIFT_IN$PR_LLCORNER$PR_BLUE$PR_HBAR$PR_SHIFT_OUT(\
|
||||
$PR_CYAN$PR_LLCORNER$PR_BLUE$PR_HBAR(\
|
||||
$PR_YELLOW%D{%H:%M:%S}\
|
||||
$PR_LIGHT_BLUE%{$reset_color%}`git_prompt_info``git_prompt_status`$PR_BLUE)$PR_CYAN$PR_SHIFT_IN$PR_HBAR\
|
||||
$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\
|
||||
$PR_LIGHT_BLUE%{$reset_color%}`git_prompt_info``git_prompt_status`$PR_BLUE)$PR_CYAN$PR_HBAR\
|
||||
$PR_HBAR\
|
||||
>$PR_NO_COLOUR '
|
||||
|
||||
# display exitcode on the right when >0
|
||||
return_code="%(?..%{$fg[red]%}%? ↵ %{$reset_color%})"
|
||||
RPROMPT=' $return_code$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_BLUE$PR_HBAR$PR_SHIFT_OUT\
|
||||
($PR_YELLOW%D{%a,%b%d}$PR_BLUE)$PR_SHIFT_IN$PR_HBAR$PR_CYAN$PR_LRCORNER$PR_SHIFT_OUT$PR_NO_COLOUR'
|
||||
RPROMPT=' $return_code$PR_CYAN$PR_HBAR$PR_BLUE$PR_HBAR\
|
||||
($PR_YELLOW%D{%a,%b%d}$PR_BLUE)$PR_HBAR$PR_CYAN$PR_LRCORNER$PR_NO_COLOUR'
|
||||
|
||||
PS2='$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\
|
||||
$PR_BLUE$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT(\
|
||||
$PR_LIGHT_GREEN%_$PR_BLUE)$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\
|
||||
$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT$PR_NO_COLOUR '
|
||||
PS2='$PR_CYAN$PR_HBAR\
|
||||
$PR_BLUE$PR_HBAR(\
|
||||
$PR_LIGHT_GREEN%_$PR_BLUE)$PR_HBAR\
|
||||
$PR_CYAN$PR_HBAR$PR_NO_COLOUR '
|
||||
}
|
||||
|
||||
setprompt
|
||||
|
||||
autoload -U add-zsh-hook
|
||||
add-zsh-hook precmd theme_precmd
|
||||
add-zsh-hook preexec theme_preexec
|
||||
add-zsh-hook preexec theme_preexec
|
||||
|
|
Loading…
Reference in a new issue