diff options
author | Brian Gernhardt <brian@gernhardtsoftware.com> | 2013-07-03 01:02:42 -0400 |
---|---|---|
committer | Brian Gernhardt <brian@gernhardtsoftware.com> | 2013-07-26 22:05:06 -0400 |
commit | ec1d2e86c81c80c03a45136827a50791de363726 (patch) | |
tree | 40aaecbb9e70799a6b52f0f3508b338b0942b5d0 /share | |
parent | 2a46b984cd990f046bb5ff3039f8e92952fab968 (diff) |
git_prompt: Add __fish_git_prompt_char_stateseparator
Unlike the rest of the __fish_git_prompt_char_* variables, it does not
have its own color because the most likely values are a space and
nothing.
based on git.git 15a54fb: prompt: introduce GIT_PS1_STATESEPARATOR
Diffstat (limited to 'share')
-rw-r--r-- | share/functions/__fish_git_prompt.fish | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/share/functions/__fish_git_prompt.fish b/share/functions/__fish_git_prompt.fish index c58ed37a..17c813b5 100644 --- a/share/functions/__fish_git_prompt.fish +++ b/share/functions/__fish_git_prompt.fish @@ -113,6 +113,10 @@ # upstream_ahead Branch has more commits (>) # upstream_diverged Upstream and branch have new commits (<>) # +# The separator between the branch name and flags can also be customized via +# __fish_git_prompt_char_stateseparator. It defaults to a space ( ) and can +# only be colored by __fish_git_prompt_color. +# # Turning on __fish_git_prompt_showcolorhints changes the colors as follows to # more closely match the behavior in bash. Note that setting any of these # colors manually will override these defaults. @@ -363,9 +367,10 @@ function __fish_git_prompt --description "Prompt function for Git" end # Formatting + set -l space "$___fish_git_prompt_color$___fish_git_prompt_char_stateseparator$___fish_git_prompt_color_done" set -l f "$w$i$s$u" if test -n "$f" - set f " $f" + set f "$space$f" end set -l format $argv[1] if test -z "$format" @@ -540,7 +545,6 @@ function __fish_git_prompt_set_char if not set -q $variable set -g $variable (set -q $user_variable_name; and echo $user_variable; or echo $char) end - end function __fish_git_prompt_validate_chars --description "__fish_git_prompt helper, checks char variables" @@ -550,6 +554,7 @@ function __fish_git_prompt_validate_chars --description "__fish_git_prompt helpe __fish_git_prompt_set_char __fish_git_prompt_char_stagedstate '+' __fish_git_prompt_set_char __fish_git_prompt_char_invalidstate '#' __fish_git_prompt_set_char __fish_git_prompt_char_stashstate '$' + __fish_git_prompt_set_char __fish_git_prompt_char_stateseparator ' ' __fish_git_prompt_set_char __fish_git_prompt_char_untrackedfiles '%' __fish_git_prompt_set_char __fish_git_prompt_char_upstream_equal '=' __fish_git_prompt_set_char __fish_git_prompt_char_upstream_behind '<' @@ -669,7 +674,7 @@ function __fish_git_prompt_repaint_color $varargs --description "Event handler, end end set -l varargs -for var in dirtystate stagedstate invalidstate stashstate untrackedfiles upstream_equal upstream_behind upstream_ahead upstream_diverged +for var in dirtystate stagedstate invalidstate stashstate untrackedfiles upstream_equal upstream_behind upstream_ahead upstream_diverged stateseparator set varargs $varargs --on-variable __fish_git_prompt_char_$var end function __fish_git_prompt_repaint_char $varargs --description "Event handler, repaints prompt when any char changes" |