From 7d7d9f05f35bfd14add0adb1291e31701a0f1a86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Fri, 12 Jul 2024 18:14:29 +0200 Subject: [PATCH] refactor(pygmalion): redo and simplify prompt sequences With this commit we put the minimal needed color resets, i.e. only when we don't control the previous text we need to do a full reset. Otherwise we can just use %F{} to change only the foreground color. --- themes/pygmalion.zsh-theme | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/themes/pygmalion.zsh-theme b/themes/pygmalion.zsh-theme index a9ce6fef0..14fe6c469 100644 --- a/themes/pygmalion.zsh-theme +++ b/themes/pygmalion.zsh-theme @@ -1,16 +1,12 @@ # Yay! High voltage and arrows! -prompt_setup_pygmalion(){ - setopt localoptions nopromptsubst extendedglob +ZSH_THEME_GIT_PROMPT_PREFIX="%{${reset_color}%}%F{green}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{${reset_color}%} " +ZSH_THEME_GIT_PROMPT_DIRTY="%F{yellow}⚡%f" +ZSH_THEME_GIT_PROMPT_CLEAN="" - ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}" - ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " - ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}" - ZSH_THEME_GIT_PROMPT_CLEAN="" +base_prompt="%{${reset_color}%}%F{magenta}%n%F{cyan}@%F{yellow}%m%F{red}:%F{cyan}%0~%F{red}|%f" +post_prompt="%{${reset_color}%}%F{cyan}⇒%f " - base_prompt='%{$fg[magenta]%}%n%{$reset_color%}%{$fg[cyan]%}@%{$reset_color%}%{$fg[yellow]%}%m%{$reset_color%}%{$fg[red]%}:%{$reset_color%}%{$fg[cyan]%}%0~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}' - post_prompt='%{$fg[cyan]%}⇒%{$reset_color%} ' - PROMPT="${base_prompt}\$(git_prompt_info)${post_prompt}" -} - -prompt_setup_pygmalion +PROMPT="${base_prompt}\$(git_prompt_info)${post_prompt}" +unset base_prompt post_prompt