matchai / spacefish

🚀🐟 The fish shell prompt for astronauts
https://spacefish.matchai.dev
MIT License
964 stars 79 forks source link

Remove duplicate Section from SPACEFISH_PROMPT_ORDER with SPACEFISH_RPROMPT_ORDER #129

Closed Fity closed 5 years ago

Fity commented 5 years ago

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 5 years ago

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
matchai commented 5 years ago

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 5 years ago

@matchai Thanks for your reply. And here is the new issue: https://github.com/denysdovhan/spaceship-prompt/issues/605

kulabun commented 5 years ago

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 5 years ago

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.

kulabun commented 5 years ago

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.