fix(fossil)!: reduce prompt spacing (#11141)

BREAKING CHANGE: the fossil plugin now ships a prompt function that
removes spacing between segments. Spaces can always be added by
changing the setting variables. Check out the README for details.

* Reduced unnecessary space in Fossil plugin prompt

The prior version was way too opinionated, adding space between each element of the prompt string, unlike common Git prompt strings.  If the user wants more space, they can override our public variables to suit.  The inverse argument doesn't hold: it's easy to add space to existing variables, but not as easy to remove it after the fact.

As part of this, changed the branch name from red to blue (matching the preceding part of the prompt) so the red "X" added to indicate a dirty branch doesn't get lost in the branch name.

* fix(fossil): keep the branch name red
* Document fossil prompt settings

---------

Co-authored-by: Robby Russell <robby@planetargon.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Marc Cornellà <marc@mcornella.com>
This commit is contained in:
authored and GitHub committed 2026-12-02 19:27:35 +01:00
1 parent 9ffcf687ef
commit 10ffeda6b5
2 files changed
+29 -6

No files matched your search

+25 -2
View File
@@ -1,7 +1,30 @@
## Fossil Plugin ## Fossil Plugin
This plugin adds completion support and prompt for fossil repositories. This plugin adds completion support and prompt for fossil repositories.
The prompt will display the current branch and status been dirty or clean.
To use it, add `fossil` to the plugins array in your .zshrc file:
```zsh
plugins=(... fossil)
``
This plugin provides a prompt function named `fossil_prompt_info` that
will display the current branch and if there are changes (dirty) or not (clean).
### Prompt segments
These variables control how the prompt function looks:
```
ZSH_THEME_FOSSIL_PROMPT_PREFIX="%{$fg_bold[blue]%}fossil:(%{$fg_bold[red]%}"
ZSH_THEME_FOSSIL_PROMPT_SUFFIX="%{$fg_bold[blue]%})"
ZSH_THEME_FOSSIL_PROMPT_DIRTY="%{$fg_bold[red]%}✖"
ZSH_THEME_FOSSIL_PROMPT_CLEAN="%{$fg_bold[green]%}✔"
```
You can override their values in your .zshrc file, anywhere after the
`source $ZSH/oh-my-zsh.sh` line.
### CONTRIBUTOR ### CONTRIBUTOR
- Jefferson González ([jgmdev](https://github.com/jgmdev))
- Jefferson González ([jgmdev](https://github.com/jgmdev))
+4 -4
View File
@@ -7,10 +7,10 @@ ZSH_THEME_FOSSIL_PROMPT_PREFIX="%{$fg_bold[blue]%}fossil:(%{$fg_bold[red]%}"
ZSH_THEME_FOSSIL_PROMPT_SUFFIX="%{$fg_bold[blue]%})" ZSH_THEME_FOSSIL_PROMPT_SUFFIX="%{$fg_bold[blue]%})"
# Text to display if the branch is dirty # Text to display if the branch is dirty
ZSH_THEME_FOSSIL_PROMPT_DIRTY=" %{$fg_bold[red]%}✖" ZSH_THEME_FOSSIL_PROMPT_DIRTY="%{$fg_bold[red]%}✖"
# Text to display if the branch is clean # Text to display if the branch is clean
ZSH_THEME_FOSSIL_PROMPT_CLEAN=" %{$fg_bold[green]%}✔" ZSH_THEME_FOSSIL_PROMPT_CLEAN="%{$fg_bold[green]%}✔"
function fossil_prompt_info() { function fossil_prompt_info() {
local branch=$(fossil branch current 2>&1) local branch=$(fossil branch current 2>&1)
@@ -25,11 +25,11 @@ function fossil_prompt_info() {
dirty="$ZSH_THEME_FOSSIL_PROMPT_DIRTY" dirty="$ZSH_THEME_FOSSIL_PROMPT_DIRTY"
fi fi
printf '%s %s %s %s %s' \ printf ' %s%s%s%s%s' \
"$ZSH_THEME_FOSSIL_PROMPT_PREFIX" \ "$ZSH_THEME_FOSSIL_PROMPT_PREFIX" \
"${branch:gs/%/%%}" \ "${branch:gs/%/%%}" \
"$ZSH_THEME_FOSSIL_PROMPT_SUFFIX" \
"$dirty" \ "$dirty" \
"$ZSH_THEME_FOSSIL_PROMPT_SUFFIX" \
"%{$reset_color%}" "%{$reset_color%}"
} }