geometry-zsh / geometry

geometry is a minimal, fully customizable and composable zsh prompt theme
ISC License
921 stars 94 forks source link

feat: Added `GEOMETRY_STATUS_SHOW_CODE` and configuration. #263

Closed alxbl closed 4 years ago

alxbl commented 4 years ago

As requested, I've ported this to the mnml branch. After looking at the status function, I figured that it made a lot of sense to have this as an option of status, so I added a configuration to show exit status.

If you'd prefer this to be a standalone function (to make it possible to have it in RPROMPT or INFO instead, let me know.

jedahan commented 4 years ago

Thanks for porting!

I think standalone is nicer, but I wonder if we should a) be exporting LAST_STATUS, or b) simply setting ? to what it should be afterwards? If its not too much trouble to have it be a separate function like geometry_exitcode that would be awesome, otherwise I will just merge this.

alxbl commented 4 years ago

I pulled the GEOMETRY_LAST_STATUS into the precmd hook, which was necessary for it to be readable while building the RPROMPT. I also made exit code into its own function as you said. This way it can be put on either side, and will use GEOMETRY_SEPARATOR.

This should be the most modular approach. I'll update the doc in a few minutes.

Cheers, Alex

alxbl commented 4 years ago

One last thing, If you have an idea for a good symbol for the exit code (I was thinking unicode cross?), I can also add the symbol for it.

alxbl commented 4 years ago

I tried to rebase this on the latest mnml but had a lot of trouble, so I ended up merging. Conflicts should be fixed. Feel free to squash merge.

jedahan commented 4 years ago

Merged it in, thanks for the contribution!

jedahan commented 4 years ago

see https://github.com/geometry-zsh/geometry/commit/0721dbbb5028f9b410df7422a3d37e3ef65dc9e0