sorin-ionescu / prezto

The configuration framework for Zsh
MIT License
13.98k stars 4.49k forks source link

Allow users to set a dirty-branch format #1990

Closed jboulter11 closed 2 years ago

jboulter11 commented 2 years ago

Proposed Changes

Example usage, taken from my own prompt:

zstyle ':prezto:module:git:info:branch' format '%%B%F{183}@%b%f%%b'
zstyle ':prezto:module:git:info:dirty-branch' format '%%B%F{225}@%b%f%%b'

Clean:

Screen Shot 2022-03-06 at 4 04 32 PM

Dirty:

Screen Shot 2022-03-06 at 4 04 43 PM
belak commented 2 years ago

It's been a while since I've looked at the git-info formatting code... as far as I can tell, we don't do anything like this anywhere else in git-info (overriding a prompt variable depending on another one). It still may be worthwhile though.

I think the example you gave can be done without this patch, by setting the dirty format to just include the color format. I took another look at this and it doesn't seem like it.

So, I think this would be worthwhile, I just worry about the ballooning complexity if there are other use cases where people want to change other parts of the prompt based on git statuses. That being said, I'm not sure if there's a good way to account for that, so I guess we could just take things as they come.

Sorry, that was a bit of a ramble - the TL;DR is that I'm inclined to accept and merge this, but I'd be curious what the other maintainers think.

jboulter11 commented 2 years ago

@belak thanks for your feedback. I agree that having these fields interact could be a slippery slope, but I think this one is pretty straightforward and the functionality is easy to understand and reason about.

If we are waiting on others, should we should give them a tag to get their attention?

jboulter11 commented 2 years ago

@belak since no one has spoken up at this point, think we can merge this one?

belak commented 2 years ago

That works! Thanks for the reminder ping!

jboulter11 commented 2 years ago

Thank you! :)