1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-22 10:40:04 +08:00
ohmyzsh/themes/pygmalion.zsh-theme
Marc Khouri fa583cfb87
refactor(pygmalion): simplify theme logic and prompt sequences (#12550)
* Simplify Pygmalion Theme

The Pygmalion theme previously had some logic for counting line length and taking action based on line length. The action was removed in c52441b624, but the counting still needlessly happens. 

This commit removes the code to count line length, and simplifies the Pygmalion theme by moving the "precmd" into the setup. 

As a bonus unintended side effect, this makes the Pygmalion theme compatible with the current async prompting logic (i.e. after this change, Pygmalion is no longer affected by https://github.com/ohmyzsh/ohmyzsh/issues/12328)

* 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.

Co-authored-by: Marc Cornellà <marc@mcornella.com>
2024-07-12 18:18:20 +02:00

13 lines
449 B
Bash

# Yay! High voltage and arrows!
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=""
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 "
PROMPT="${base_prompt}\$(git_prompt_info)${post_prompt}"
unset base_prompt post_prompt