jnoortheen / xontrib-powerline3

powerline theme for xonsh with async prompt support.
MIT License
11 stars 4 forks source link

$PROMPT_FIELDS["gitstatus__pl_colors"] overwritten #10

Open sbliven opened 2 years ago

sbliven commented 2 years ago

I am trying to change the color of the 'gitstatus' part of my prompt. In my .xonshrc I have

$PROMPT_FIELDS["gitstatus__pl_colors"] = ("#273746", "GREEN")

However when I open a new shell I see

> $PROMPT_FIELDS["gitstatus__pl_colors"]
('INTENSE_WHITE', '#88B04B')

Setting the field directly in the new shell successfully changes the color. Thus it seems like some part of the powershell3 initialization is overriding my xonshrc value.

sbliven commented 2 years ago

I'm using the following workaround:

def _color_patch():
    """Attempt to fix gitstatus__pl_colors bug
    https://github.com/jnoortheen/xontrib-powerline3/issues/10

    Needs to be added to $PROMPT after {gitstatus}
    """
    __xonsh__.env['PROMPT_FIELDS']["gitstatus__pl_colors"] = (DARK_GREY, "GREEN")
    return ""
$PROMPT_FIELDS["color_patch"] = _color_patch
$PROMPT += "{color_patch}" 

Make sure {color_patch} comes after {gitstatus} in $PROMPT

jnoortheen commented 2 years ago

Are you loading the xontrib before these env variables definitions?