matchai/spacefish

Remove duplicate Section from SPACEFISH_PROMPT_ORDER with SPACEFISH_RPROMPT_ORDER

Fity opened this issue · 6 comments

Fity commented

Feature Request

Is your feature request related to a problem? Please describe.
Simple with SPACEFISH_TIME_SHOW option, if we want to add time section to right prompt(and not also on the left prompt), we have to redefine the SPACEFISH_PROMPT_ORDER option.

Describe the solution you'd like
When a section is in the right prompt, remove it from left prompt.

Describe alternatives you've considered
Remove the section in config.fish manually.

Fity commented

Currently, I updated fish_prompt.fish and ignore the duplicated sections. Now my for loop for render sections is like this:

if set -q SPACEFISH_RPROMPT_ORDER
    set -a prompts_to_ignore $SPACEFISH_RPROMPT_ORDER
else
	set -a prompts_to_ignore ''
end

for i in $SPACEFISH_PROMPT_ORDER
	if not contains $i $prompts_to_ignore
		eval __sf_section_$i
	end
end

Hey @Fity! Thanks for opening up an issue.

This sounds like a very reasonable thing to add, and it sounds like it would also benefit spaceship to have it added as a feature. Since this project is aiming to achieve feature-parity with spaceship, I suggest you make an issue on that project to address your requested feature. 🚀

Once they've accepted it, we will gladly port it over to this project. 😄

Fity commented

@matchai Thanks for your reply. And here is the new issue: spaceship-prompt/spaceship-prompt#605

For me it look like very and very bad idea. If I have time in PROMPT I will definitely expect it to be displayed here whatever I set in RPROMPT. And if I will not find it displayed I will consider it as a bug or configuration problem. It's is two independent configuration properties.

Fity commented

Yes, if we manually add time to PROMPT, it may be a bad idea. But for most users, they will not know time in PROMPT before they set time to enabled.

Maybe we could add a new flag to control if we want RPROMPT to overwrite PROMPT.

So the problem is in duplicated controls _SHOW flags and PROMPT. I think it's better to drop _SHOW flags rather then create third control for the same thing.