[zshrc] Redesign prompt

This commit is contained in:
lara 2020-06-18 21:50:02 -04:00
parent 585344158f
commit c28e9f9d50

16
prompt
View file

@ -6,9 +6,9 @@
# and changes the color of the username
color_username () {
if [[ $EUID -eq 0 ]]; then
echo "%{$fg_bold[red]%}%n"
echo "%{$fg_no_bold[red]%}%n"
else
echo "%{$fg_bold[green]%}%n"
echo "%{$fg_no_bold[blue]%}%n"
fi
}
@ -16,17 +16,19 @@ color_prompt_char () {
if [[ $EUID -eq 0 ]]; then
echo "%{$fg_no_bold[red]%}#%{$reset_color%}"
else
echo "%{$fg_no_bold[green]%}$%{$reset_color%}"
echo "%{$fg_no_bold[blue]%}$%{$reset_color%}"
fi
}
# Host coloring, specific to Rezometz
# Host coloring, personalise to your own taste
color_host () {
local couleur_hote=""
case $HOST in
TwelveYearsAndStillGoingStrong|lharkinateur|BecauseROSThatSWhy|lharktop|blieuxor)
couleur_hote=green;;
pixie)
couleur_hote=cyan;;
chimay|orval)
chimay|orval|serenity)
couleur_hote=magenta;;
babel|taima|era|vidar|okami|athena)
couleur_hote=red;;
@ -117,7 +119,7 @@ prompt_msg () {
# https://dougblack.io/words/zsh-vi-mode.html
vim_mode () {
VIM_NORMAL="%{$fg_bold[red]%}[% N]% "
VIM_INSERT="%{$fg_bold[green]%}[% I]% "
VIM_INSERT="%{$fg_bold[blue]%}[% I]% "
VIM_PROMPT="${${KEYMAP/vicmd/$VIM_NORMAL}/(main|viins)/$VIM_INSERT}"
echo "$VIM_PROMPT%{$reset_color%}"
}
@ -213,7 +215,7 @@ prompt_create zle-line-init zle-keymap-select () {
PROMPT+="$(virtual_env)$(prompt_chars) %{$reset_color%}"
# Right prompt with current repo informations
RPROMPT="${vcs_info_msg_0_}%E%{$reset_color%}"
RPROMPT="${vcs_info_msg_0_}%{$reset_color%}%E"
zle reset-prompt
}