anki-code / xontrib-prompt-starship

Starship cross-shell prompt in xonsh shell.
MIT License
52 stars 8 forks source link

Make starship better than native with Left and Right prompts! #3

Closed eugenesvk closed 3 years ago

eugenesvk commented 3 years ago

Although the starship prompt by itself doesn't yet support splitting prompts into the Left and Right ones (though there is some draft PR that can change that), the awesomeness of xonsh allows us to have both prompts within starship even before they support it — we just need to feed starship a different $STARSHIP_CONFIG environment variable for each part

anki-code commented 3 years ago

Hi! Thank you for opening this! Please give me repeatable example of how it works i.e. two configs.

eugenesvk commented 3 years ago

You can use any config, but here is a simple example https://gist.github.com/eugenesvk/fd185f49017cb64a4cfb076bde8b605d with the left prompt ending with and the right prompt starting with

anki-code commented 3 years ago

Thanks! Works great! 🎉

anki-code commented 3 years ago

JFYI @eugenesvk I've added bottom toolbar support. It looks ugly because it has inverted of colors. Hope someone fix it in the future.

eugenesvk commented 3 years ago

By the way, what issues do you have?

In case of using left and right prompt with more than one line the result could have issues. The case with more than one line not properly tested.

I checked a multiline prompt and seems to be working as expected (although I haven't tested it properly either)? Here I've put a bunch of $line_break\'s in the configs multiline prompts (except for this bug https://github.com/prompt-toolkit/python-prompt-toolkit/issues/1241, had to add top=0 back if I wanted the right prompt stick at the top)

I've added bottom toolbar support. It looks ugly because it has inverted of colors. Hope someone fix it in the future.

Oh, cool, didn't even know this existed

anki-code commented 3 years ago

Default starship config. When I run clear:

![image](https://user-images.githubusercontent.com/1708680/110963916-b1a03680-8363-11eb-8686-dc58a582cf40.png)

Then press enter:

![image](https://user-images.githubusercontent.com/1708680/110963976-c11f7f80-8363-11eb-94fd-61f9292acc31.png)

More and more:

![image](https://user-images.githubusercontent.com/1708680/110964024-cc72ab00-8363-11eb-9ae3-cfd20e02a25f.png)

Finally I don't understand what right prompt belongs to what left prompt. Maybe I'm just used to prompt_bar.

eugenesvk commented 3 years ago

Oh, I see, that's the bug in ptk I mentioned, might want to add it to readme so people are aware of a workaround

(except for this bug https://github.com/prompt-toolkit/python-prompt-toolkit/issues/1241, had to add top=0 back if I wanted the right prompt stick at the top)

By default you have right prompt at the bottom, and then it moves to the bottom of the previous line on enter (which turns out to be physically at the top of the screen). But if you fix the bug above, it'll always be at the top like at my screenshot

anki-code commented 3 years ago

Done! Thanks! https://github.com/anki-code/xontrib-prompt-starship#known-issues

anki-code commented 3 years ago

Hi @eugenesvk ! JFYI I've added Starship support to prompt-bar.