I am trying to reset
my custom prompt using a shell hook when activating an environment:
shell.hook = ''
eval "$(starship init zsh)"
I tried various quoting of
$ but nothing seemed to work and I am not getting a starship prompt.
Could someone please help me to debug this?
March 20, 2023, 3:39pm
Howdy, I have an idea of what might be going on here but I’m working with our engineers to test my theory.
Thanks for your report and I’ll get back with you soon with my findings.
March 21, 2023, 9:10pm
Alright this one has a pretty simple solution.
So the issue you were running into was essentially that
flox activate sets
PROMPT at the end of its run, after
shell.hook is executed, so this was wiping out your settings.
The good news is there’s an environment variable
FLOX_PROMPT_DISABLE=1; that will suppress setting
PS1, which would allow your settings to survive.
Here’s an example:
$ FLOX_PROMPT_DISABLE=1 flox activate -e foo;
$ # or
$ export FLOX_PROMPT_DISABLE=1;
$ flox activate -e foo;
Note that setting
environmentVariables.FLOX_PROMPT_DISABLE will have no effect. It should be set before running
It’s working thanks! And since I am using starship to still display the activated environments, here’s my configuration:
right_format = '$env_var'
variable = 'FLOX_PROMPT_ENVIRONMENTS'
format = '[$env_value]($style)'
default = 'none'
Then I am not missing anything
March 22, 2023, 6:29pm
Radical. I’m glad I was able to help.