-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prompt element colours will not use customised colours #153
Comments
You will need to erase the variable before overriding them as discussed in #138
|
@edouard-lopez apart from the fact that we need to elaborate this in README, as anything we can do to simplify this? |
So, just to be clear, the problem lies in the fact that Here is a couple of solutions:
and evaluate their values on invocation
Obviously this is quite ugly and hacky (maybe even a bit slower).
If @jorgebucaran like to chime in and talk wisdom to us, that would be very helpful too |
Don't tell people to use set -x pure_color_prompt_on_success (set_color green) |
I would like to salvage ability to set base colors for users though, seems useful to me |
@schrodincat Then something like this. function _pure_prompt_symbol
set -l prompt_color $pure_color_prompt_on_success
if set -q pure_color_success
set prompt_color $pure_color_success
end
# ...
echo "$prompt_color$prompt_symbol"
end |
@jorgebucaran although it implicitly assumes that For now, though, I've tried to fix this making base color variables universal. |
@schrodincat I very much appreciate you trying to tackle the issue, but I am not sure how making colour variables universal will achieve this? As you stated quite correctly
to my best understanding, this means that after the changes
Am I missing something? To me, it appears that the universal variable solution would only work if
Assuming my analysis is correct, making base colours universal is the right first step, but you will need a dynamic evaluation of the assignment of base colours to derived prompt properties, be it through an |
Universal variables are meant to be set mainly by hand in a terminal, it's kind of a replacement for In my opinion, all other proposed solutions are making the code either slower or too convoluted because they are essentially trying to fight how |
So it does, you are right and I was wrong; apologies for a hasty misreading.
You are missing one essential behaviour of universal variables, the one making them far more than a way to set variables persistently without touching
(emphasis mine). I have made a GIF illustrating exactly that: This behaviour makes uvars ideal for shell wide persistent user settings; in fact, as the docs mention, one of their functions out of the box is to set fish’s own colours persistently and across all sessions 😉. Switching pure’s colour variables to universal vars thus is a good step; the problem is these universal variables will currently still only be assigned to prompt elements on shell start-up, no matter how the uvars were set (the right way, interactively, or the pointless way, in |
@kopischke I think I misunderstood jorgebucaran solution the first time. I’ll be able to solve this issue without enforcing universal scope on to variables, like you want me too, in more idiomatic way. PR is coming, however, it won’t be available till the end of the next week. |
@schrodincat very cool! Thanks for that, and no rush. |
Because the colours of the prompt elements like the success and error prompt symbols (
pure_color_prompt_on_symbols
andpure_color_prompt_on_error
) are assigned and exported in aconf.d
snippet, which is sourced before the user configuration file (config.fish
), overriding colour variables (pure_color_X
) inconfig.fish
per the README will not actually affect the colours of elements assigned this colour in interactive login shell sessions.To reproduce
on macOS 10.14, using Terminal.app and fish set as default shell via
chsh
install pure
add the following line to your
config.fish
:start a new fish session by opening a new Terminal window
Expected result: the success prompt symbol is green
Actual result: the success prompt symbol is magenta
Notes: oddly enough, this works as expected in a subshell (“oddly enough” because the fish help clearly states all configuration files, including snippets, are read on every shell start, but this behaviour only makes sense if fish actually skips reading snippets in a non-login shell).
The text was updated successfully, but these errors were encountered: