-
-
Notifications
You must be signed in to change notification settings - Fork 973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move Git action after dirty with space and default color #506
Conversation
I agree it makes sense that |
Here's a few: |
How about |
I think it's best for the git action to be on the right so that the branch name stays in the same position (more or less) as you work.
Maybe we have different mental models. To me, the current git action is orthogonal to the current git branch. I would not say that a branch is in a state of rebase or merge. |
Good! I'll code that up. |
Umm can you give me a hint for getting dimmed gray? Do I need to add an entry to |
You can see the ansi codes for |
No, I don't think we need the parens to be customizable. |
9fdd098
to
194ba00
Compare
Okay, ready for review. |
@mafredri LGTY? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, but I'd like some clarity on the escape codes used.
87a5425
to
a95c71c
Compare
I updated the code to...
@romkatv raised an issue about the "faint" escape code not being portable. I don't really understand that issue well enough to comment... |
a95c71c
to
e5a4d2d
Compare
Rebased again to update the readme color diagram with user@host at the beginning. |
I can't really speak for how well it's supported either, but I do think there is potential for trouble. Thinking of terminals like the Emacs terminal or (u)rxvt. But also, I do think the color needs to be configurable, otherwise it's kind of anti-theme-ability (that one pesky color you can't change). And if it's configurable, then there's really no reason for it to be faded either (as that would also go against theme-ability). We'd just pick a darker / more faded color. |
If the dim style is not supported, it will just be gray, which is fine too. I don't really see the problem.
The benefit of dimming gray is that we just take the gray the user has chosen and that fits with their theme and make it dimmer. If we pick a darker color, it might not look good when put in front of some terminal background colors. |
Color 7 is "white". This is often the same color as default foreground, so it's rather bright. On terminals without dim style parentheses will stand out. They'll be much brighter than branch name, for example. Pure currently uses color 242 in several places (including branch name), which is always I don't have a strong opinion here. I personally wouldn't define default parameters that make prompt looks weird on terminals without dim style support. I'll survive if you do that, so don't mind me. I'll deal with potential complaints from powerlevel10k users who enable Pure style with the usual retort -- "that's how Pure does it." |
If it’s white, that’s wrong. I asked for gray, which is technically called “ansi bright black” (code 90). |
That would be color 8 ( Note that color 8 (without dim) is invisible in Solarized Dark. Color 8 with dim is almost invisible in Tango Dark. I believe these color schemes are among the most popular, if not the most popular. |
In my test, dim 7, 8, and 90 all look the same and are all invisible in Solarized Dark. That does seem like a non-starter. @romkatv do you have any suggestions? |
I wouldn't presume to suggest but I can tell you what I would do if this was up to me. I wouldn't use parentheses. They are out of place in Pure prompt as it currently has no brackets of any kind. Different parts of prompt are simply separated by spaces and distinguished by colors. The original screenshot you've posted looks fine to me: I respect the right of @sindresorhus to run this project the way he likes. I don't use Pure myself, so my opinion carries no weight. |
I agree 100% 👆, except I am a Pure user. I could take or leave the parenthesis. |
That's a problem with those color schemes and not really a concern for Pure. |
The benefit of dimming instead of choosing a darker colors is that it works no matter whether the terminal background is dark or light. |
Seems like the parens cause too much problems. Let's just drop them. We can tweak the look in the future if we think of a better way to present it. |
The git action now displays after the "dirty" symbol. Before: branch|rebase-i* After: branch* (rebase-i)
e5a4d2d
to
96d40a8
Compare
96d40a8
to
cc0d480
Compare
…s#506) Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
* upstream/master: 1.12.0 Respawn Pure async worker on crash (sindresorhus#543) Use HTTPS links Fix stash during git action (sindresorhus#535) Move Git action after dirty with space and default color (sindresorhus#506)
…ster * 'master' of https://github.com/sindresorhus/pure: 1.14.0 More system report improvements (sindresorhus#568) Use GIT_OPTIONAL_LOCKS=0 instead of --no-optional-locks (sindresorhus#569) Show user@host when running in a container (sindresorhus#564) Update zsh-async to v1.8.4 (sindresorhus#566) Add zsh-async version to system report (sindresorhus#567) Bump Pure internal version when publishing package (sindresorhus#565) Update readme.md 1.13.0 Respect Git config `status.showUntrackedFiles` (sindresorhus#542) Add forivall/pure to Ports section in the readme (sindresorhus#556) Fix '--no-optional-locks' argument position (sindresorhus#553) Eliminate unnecessary Git locking (sindresorhus#549) Readme tweaks 1.12.0 Respawn Pure async worker on crash (sindresorhus#543) Use HTTPS links Fix stash during git action (sindresorhus#535) Move Git action after dirty with space and default color (sindresorhus#506)
…s#506) Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
Summary
Moves the dirty indicator to be always adjacent to the branch. Separate the git action with a space instead of a pipe. Bestow a distinct default color to the git action, yellow.
This is following up to other recent changes #491 and #486. (which are great!)
I feel that the re-arranging would be a less welcome change without the default color also being changed.
Before:
After:
Of course this is all subjective but here is my rationale...
The dirty indicator should be adjacent to the branch since they are very closely related in my mind. Together they tell me the status of the working tree. The git action seems like it belongs at the end since it is a "special state", relatively uncommon, important to notice. A space and a distinct color is cleaner and more readable than a pipe.
I chose yellow instead of red (as in #486) for the git action since red looks like an error.
If these changes are agreed upon, I can update the readme too.