zshrc: Match fish prompt
This commit is contained in:
parent
69ff722e06
commit
0da7ce606e
1 changed files with 12 additions and 7 deletions
19
zshrc
19
zshrc
|
@ -67,12 +67,18 @@ case $TERM_PROGRAM in
|
|||
;;
|
||||
esac
|
||||
|
||||
__color() { print "%{\e[$1m%}" }
|
||||
__color_256() { __color "38;5;$1" }
|
||||
__reset_color() { __color 0 }
|
||||
|
||||
set_prompt() {
|
||||
PS1="%m:%c$@%B%(!.#.$)%b "
|
||||
PS1="$(__color_256 23)%m "
|
||||
PS1+="$(__color_256 29)%c"
|
||||
PS1+="$@$(__color_256 36)%B%(!.#.>)$(__reset_color) "
|
||||
PS2="%B>%b "
|
||||
RPS1="%(1j.%{$(print "\e[1;33m")%}%j%{$(print "\e[0m")%}.)"
|
||||
RPS1+="%(?..%(1j. .)%{$(print "\e[1;31m")%}%?%{$(print "\e[0m")%})"
|
||||
RPS2="%(1_.%{$(print "\e[1;30m")%}(%_%)%{$(print "\e[0m")%}.)"
|
||||
RPS1="%(1j.$(__color "1;33")%j$(__reset_color).)"
|
||||
RPS1+="%(?..%(1j. .)$(__color "1;31")%?$(__reset_color))"
|
||||
RPS2="%(1_.$(__color "1;30")(%_%)$(__reset_color).)"
|
||||
}
|
||||
set_prompt
|
||||
|
||||
|
@ -82,9 +88,8 @@ __precmd() {
|
|||
local branch_name=$(git symbolic-ref HEAD 2>/dev/null)
|
||||
branch_name=${branch_name##refs/heads/}
|
||||
if [ -n "$branch_name" -a "$branch_name" != master ]; then
|
||||
local branch="%{$(print "\e[1;30m")%}("
|
||||
branch+="%{$(print "\e[0;36m")%}$branch_name"
|
||||
branch+="%{$(print "\e[1;30m")%})%{$(print "\e[0m")%}"
|
||||
local branch="$(__color_256 36)($(__color_256 78)$branch_name"
|
||||
branch+="$(__color_256 36))"
|
||||
fi
|
||||
set_prompt $branch
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue