diff --git a/plugins/fossil/README.md b/plugins/fossil/README.md index 5bb47b7d5..62758173c 100644 --- a/plugins/fossil/README.md +++ b/plugins/fossil/README.md @@ -1,7 +1,30 @@ ## Fossil Plugin 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 - - Jefferson González ([jgmdev](https://github.com/jgmdev)) + +- Jefferson González ([jgmdev](https://github.com/jgmdev)) diff --git a/plugins/fossil/fossil.plugin.zsh b/plugins/fossil/fossil.plugin.zsh index fadf6095d..29e684f76 100644 --- a/plugins/fossil/fossil.plugin.zsh +++ b/plugins/fossil/fossil.plugin.zsh @@ -7,10 +7,10 @@ ZSH_THEME_FOSSIL_PROMPT_PREFIX="%{$fg_bold[blue]%}fossil:(%{$fg_bold[red]%}" ZSH_THEME_FOSSIL_PROMPT_SUFFIX="%{$fg_bold[blue]%})" # 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 -ZSH_THEME_FOSSIL_PROMPT_CLEAN=" %{$fg_bold[green]%}✔" +ZSH_THEME_FOSSIL_PROMPT_CLEAN="%{$fg_bold[green]%}✔" function fossil_prompt_info() { local branch=$(fossil branch current 2>&1) @@ -25,11 +25,11 @@ function fossil_prompt_info() { dirty="$ZSH_THEME_FOSSIL_PROMPT_DIRTY" fi - printf '%s %s %s %s %s' \ + printf ' %s%s%s%s%s' \ "$ZSH_THEME_FOSSIL_PROMPT_PREFIX" \ "${branch:gs/%/%%}" \ - "$ZSH_THEME_FOSSIL_PROMPT_SUFFIX" \ "$dirty" \ + "$ZSH_THEME_FOSSIL_PROMPT_SUFFIX" \ "%{$reset_color%}" }