prompt: don't set default colors twice

The colors are set in __fish_config_interactive before the prompt is
painted for the first time.

Also initialize the $fish_color_status for the (pipe) status, bump the
version for that.
[ci skip]
This commit is contained in:
Johannes Altmanninger 2019-12-11 10:12:10 +01:00
parent 3f10da0d01
commit 2f1a5e65d8
6 changed files with 4 additions and 23 deletions

View file

@ -44,9 +44,7 @@ function __fish_config_interactive -d "Initializations that should be performed
#
# If we are starting up for the first time, set various defaults.
#
# bump this to 2_4_0 when rolling release if anything changes after 9/10/2016
if not set -q __fish_init_2_39_8
if not set -q __fish_init_3_1_0
# Regular syntax highlighting colors
__init_uvar fish_color_normal normal
@ -61,9 +59,9 @@ function __fish_config_interactive -d "Initializations that should be performed
__init_uvar fish_color_quote 999900
__init_uvar fish_color_autosuggestion 555 brblack
__init_uvar fish_color_user brgreen
__init_uvar fish_color_host normal
__init_uvar fish_color_valid_path --underline
__init_uvar fish_color_status red
__init_uvar fish_color_cwd green
__init_uvar fish_color_cwd_root red
@ -92,7 +90,8 @@ function __fish_config_interactive -d "Initializations that should be performed
#
__init_uvar fish_color_history_current --bold
set -U __fish_init_2_39_8
set -e __fish_init_2_39_8
set -U __fish_init_3_1_0
end
#

View file

@ -5,13 +5,8 @@ function fish_prompt --description 'Write out the prompt'
set -l last_pipestatus $pipestatus
set -l normal (set_color normal)
# Initialize our variables.
set -q fish_color_user
or set -U fish_color_user -o green
set -q fish_color_host
or set -U fish_color_host -o cyan
set -q fish_color_status
or set -U fish_color_status red
# Color the prompt differently when we're root
set -l color_cwd $fish_color_cwd

View file

@ -5,9 +5,6 @@ function fish_prompt --description "Write out the prompt"
# Save our status
set -l last_pipestatus $pipestatus
set -q fish_color_status
or set -U fish_color_status red
set -l color_cwd
set -l suffix
switch "$USER"

View file

@ -7,12 +7,8 @@ function fish_prompt --description 'Write out the prompt'
set -l normal (set_color normal)
# Initialize our variables.
set -q fish_color_user
or set -U fish_color_user -o green
set -q fish_color_host
or set -U fish_color_host -o cyan
set -q fish_color_status
or set -U fish_color_status red
# Color the prompt differently when we're root
set -l color_cwd $fish_color_cwd

View file

@ -5,9 +5,6 @@ function fish_prompt --description 'Informative prompt'
#Save the return status of the previous command
set -l last_pipestatus $pipestatus
set -q fish_color_status
or set -U fish_color_status red
switch "$USER"
case root toor
printf '%s@%s %s%s%s# ' $USER (prompt_hostname) (set -q fish_color_cwd_root

View file

@ -56,9 +56,6 @@ function fish_prompt --description 'Write out the prompt'
set -g __fish_git_prompt_color_cleanstate green --bold
end
set -q fish_color_status
or set -U fish_color_status red
set -l color_cwd
set -l prefix
set -l suffix