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