Spaceship-prompt: Modifying `SPACESHIP_PROMPT_DEFAULT_PREFIX` has no effect

Created on 13 Jan 2020  路  13Comments  路  Source: denysdovhan/spaceship-prompt

This is in reference to this issue comment.

Current behavior

Modifying the value of SPACESHIP_PROMPT_DEFAULT_PREFIX does not have any affect on the rendered prompt.

Expected behavior

If set in a .zshrc file, a line such as

export SPACESHIP_PROMPT_DEFAULT_PREFIX="&"

and/or

export SPACESHIP_RPROMPT_DEFAULT_PREFIX="&"

should overwrite the default value of via, and any prompt sections which utilize this prefix should display the configured value.

Relevant Zsh configuration (.zshrc)

I have configured the value in a .spaceship-config.zsh file:

export SPACESHIP_PROMPT_DEFAULT_PREFIX="&"

which is sourced by my .zshrc file:

for file in ~/.{p10k.zsh,spaceship-config.zsh,credentials,fzf.zsh}; do
  [ -r "$file" ] && [ -f "$file" ] && source "$file";
done;

Environment

Spaceship version: 3.11.2
Zsh version: 5.7.1
Zsh framework: oh-my-zsh
Zsh plugin manager: None
Terminal emulator: iTerm
Operating system: macOS

Screenshot

Screen Shot 2020-01-13 at 2 14 33 PM

All 13 comments

Try exec -l $SHELL

That does change the string, but it seems to ruin the spacing? Per the documentation, there are no spaces surrounding the default of via, but when changing it to & and executing exec -l $SHELL, the spaces between the prefix and the section's content are removed:
Screen Shot 2020-01-15 at 11 05 50 AM
I did not modify $SPACESHIP_PROMPT_DEFAULT_SUFFIX anywhere.

Additionally, this only persists until the terminal restarts, at which point the prompt loads with the default value once again.

Yes , Doc is wrong. You should use SPACESHIP_PROMPT_DEFAULT_PREFIX="& " (add a space)
If you want it persists, you can add config in .zshrc

I can't imagine why this issue would have been closed. I see no PR to address this issue, and I think I've been pretty clear that adding this config option to my .zshrc file has no effect, and that using exec -l $SHELL is not a satisfactory solution.

@PSalant726 You need to define SPACESHIP_PROMPT_DEFAULT_PREFIX before sourcing spaceship. The fact that exec zsh makes a difference suggests that you are defining it after.

Yes, understood, but I do not feel that that is an adequate solution to this problem. I have not discovered any other configuration variables that must be defined outside of a contained config file sourced after spaceship, nor is there any documentation to suggest that SPACESHIP_PROMPT_DEFAULT_PREFIX behaves this way.

Yes, understood, but I do not feel that that is an adequate solution to this problem.

Weren't you able to achieve what you wanted? Is there anything you need help with?

Weren't you able to achieve what you wanted?

Yes, but only after opening a GH issue. When configuring this value alongside all other configuration variables, it did not work. At best, this is unexpected behavior. At worst, this is a bug.

Are you satisfied with the behavior of SPACESHIP_PROMPT_DEFAULT_PREFIX? I'm not. It contributes to a poor user experience and should be modified to behave like the rest of the prompt configuration options. I believe that is what the PR which closes this issue should address. At the very least, this behavior should be documented so that future users can make changes on their own.

Weren't you able to achieve what you wanted?

Yes

Awesome!

Are you satisfied with the behavior of SPACESHIP_PROMPT_DEFAULT_PREFIX?

I don't have an opinion as I'm not using Spaceship. I'm the guy who wrote the theme from which you've switched to Spaceship :wave:.

It contributes to a poor user experience and should be modified to behave like the rest of the prompt configuration options. I believe that is what the PR which closes this issue should address.

I'm convinced. Send it.

I'm the guy who wrote the theme from which you've switched to Spaceship 馃憢.

馃槷 !! I loved p9k and p10k, thanks for working on those! I was just looking for something a little more lightweight. Looks like this theme still has a ways to go.

I'm convinced. Send it.

Maybe I'll get around to it eventually. Still, I think this issue should stay open until it's addressed.

@PSalant726 Hi, put SPACESHIP_PROMPT_DEFAULT_PREFIX="& " into .zshrc and reload your terminal. Does it not work ?

OK, I understood. https://github.com/denysdovhan/spaceship-prompt/blob/master/docs/Options.md#prompt variables are global and default. If you want change a section, you should not change global default.

For example, if you want to change node section prefix, you should use SPACESHIP_NODE_PREFIX not global SPACESHIP_PROMPT_DEFAULT_PREFIX (which need you put .zshrc and reload terminal).
I think this is our wanted. If you think documentation is not clear, you can write a PR to fix it, welcome.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

conradwt picture conradwt  路  3Comments

tbekaert picture tbekaert  路  3Comments

AlecRust picture AlecRust  路  3Comments

doole picture doole  路  4Comments

ChadTaljaardt picture ChadTaljaardt  路  4Comments