mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-15 15:05:27 +08:00
fish_git_prompt: Print cleanstate character whenever it's defined
And then only define it in informative mode.
This commit is contained in:
parent
ca9910edb7
commit
3552a11afa
@ -80,10 +80,8 @@ A number of variables set characters and color used as indicators. Many of these
|
||||
- ``$__fish_git_prompt_color_bare`` - the color to use for a bare repository - one without a working tree
|
||||
- ``$__fish_git_prompt_color_merging`` - the color when a merge/rebase/revert/bisect or cherry-pick is in progress
|
||||
|
||||
Some variables are only used in some modes, like when informative status is enabled:
|
||||
|
||||
- ``$__fish_git_prompt_char_cleanstate`` (✔) - the character to be used when nothing else applies
|
||||
- ``$__fish_git_prompt_color_cleanstate``
|
||||
- ``$__fish_git_prompt_char_cleanstate`` (✔ in informative mode) - the character to be used when nothing else applies
|
||||
- ``$__fish_git_prompt_color_cleanstate`` (no default)
|
||||
|
||||
Variables used with ``showdirtystate``:
|
||||
|
||||
|
@ -331,6 +331,10 @@ function fish_git_prompt --description "Prompt function for Git"
|
||||
end
|
||||
if test -n "$b"
|
||||
set b "$branch_color$b$branch_done"
|
||||
if test -z "$dirtystate$untrackedfiles$stagedstate"; and test -n "$___fish_git_prompt_char_cleanstate"
|
||||
and not set -q __fish_git_prompt_show_informative_status
|
||||
set b "$b$___fish_git_prompt_color_cleanstate$___fish_git_prompt_char_cleanstate$___fish_git_prompt_color_cleanstate_done"
|
||||
end
|
||||
end
|
||||
if test -n "$c"
|
||||
set c "$___fish_git_prompt_color_bare$c$___fish_git_prompt_color_bare_done"
|
||||
@ -528,8 +532,11 @@ function __fish_git_prompt_set_char
|
||||
end
|
||||
|
||||
function __fish_git_prompt_validate_chars --description "fish_git_prompt helper, checks char variables"
|
||||
# cleanstate is only defined with actual informative status.
|
||||
set -q __fish_git_prompt_show_informative_status
|
||||
and __fish_git_prompt_set_char __fish_git_prompt_char_cleanstate '✔'
|
||||
or __fish_git_prompt_set_char __fish_git_prompt_char_cleanstate ''
|
||||
|
||||
__fish_git_prompt_set_char __fish_git_prompt_char_cleanstate '✔'
|
||||
__fish_git_prompt_set_char __fish_git_prompt_char_dirtystate '*' '✚'
|
||||
__fish_git_prompt_set_char __fish_git_prompt_char_invalidstate '#' '✖'
|
||||
__fish_git_prompt_set_char __fish_git_prompt_char_stagedstate '+' '●'
|
||||
|
Loading…
x
Reference in New Issue
Block a user