Spaceship-prompt: All default sections, and only default sections, are sourced

Created on 1 Apr 2018  Â·  3Comments  Â·  Source: denysdovhan/spaceship-prompt

spaceship.zsh#L112

https://github.com/denysdovhan/spaceship-prompt/blob/5a391a571a0a05a038d880e7359228f6c3525511/spaceship.zsh#L112

runs before user customizations are applied to SPACESHIP_PROMPT_ORDER and SPACESHIP_RPROMPT_ORDER.

Instead of sourcing the contents of these arrays, it would be safer to source everything in /sections. There'd be no change to what's sourced, and the union call would be removed.

Ideally only things in the final arrays would be sourced. If there's some way to ask "is this the initial load?" and move the sourcing downstream (looks like maybe it has to be in spaceship_prompt()?) that'd be nice. But this might be #wontfix — I've been playing with it, and can't find a good way to do it.

docs help-wanted

Most helpful comment

Huh, nicely spotted, I've actually never noticed this part of the documentation and discovered myself by trial and error 🙂

All 3 comments

Just make sure your SPACESHIP_PROMPT_ORDER is defined before spaceship-prompt is being sourced, and your user customizations will be applied. I'm using this approach, it works.

I see that does work.

The documentation states firmly that customizations should go after the theme, so I'm surprised nothing breaks.

The documentation is easy enough to edit, but if there are any future changes where this matters I'm not sure users could be expected to say "I wonder if they flipped that rule?"

https://github.com/denysdovhan/spaceship-prompt/blob/ea5851140a7f5d13fea35e2037df121c62da7311/docs/Options.md#L3

Huh, nicely spotted, I've actually never noticed this part of the documentation and discovered myself by trial and error 🙂

Was this page helpful?
0 / 5 - 0 ratings