mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-27 14:45:13 +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_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
|
- ``$__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`` (✔ in informative mode) - the character to be used when nothing else applies
|
||||||
|
- ``$__fish_git_prompt_color_cleanstate`` (no default)
|
||||||
- ``$__fish_git_prompt_char_cleanstate`` (✔) - the character to be used when nothing else applies
|
|
||||||
- ``$__fish_git_prompt_color_cleanstate``
|
|
||||||
|
|
||||||
Variables used with ``showdirtystate``:
|
Variables used with ``showdirtystate``:
|
||||||
|
|
||||||
|
@ -331,6 +331,10 @@ function fish_git_prompt --description "Prompt function for Git"
|
|||||||
end
|
end
|
||||||
if test -n "$b"
|
if test -n "$b"
|
||||||
set b "$branch_color$b$branch_done"
|
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
|
end
|
||||||
if test -n "$c"
|
if test -n "$c"
|
||||||
set c "$___fish_git_prompt_color_bare$c$___fish_git_prompt_color_bare_done"
|
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
|
end
|
||||||
|
|
||||||
function __fish_git_prompt_validate_chars --description "fish_git_prompt helper, checks char variables"
|
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_dirtystate '*' '✚'
|
||||||
__fish_git_prompt_set_char __fish_git_prompt_char_invalidstate '#' '✖'
|
__fish_git_prompt_set_char __fish_git_prompt_char_invalidstate '#' '✖'
|
||||||
__fish_git_prompt_set_char __fish_git_prompt_char_stagedstate '+' '●'
|
__fish_git_prompt_set_char __fish_git_prompt_char_stagedstate '+' '●'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user