-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Add (customizable) vcs:
prefix to version-control
statusline element
#6646
base: master
Are you sure you want to change the base?
Conversation
Hi! FYI this overlaps with #2869 which implements this in a more generic way, that allows to style this particular element's icon. |
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.
I do something similar in my local config by abusing the separator element but that doesn't work as well because you can't use other the separator elsewhere and the symbol is shown even if there is no VCS repo.
However, I am not sure if we want to keep adding a bunch of config options to each statusline element (what about a glyph after the version control element separator, what about status-line element foo, ...). Maybe just adding a generic { glyph = ".." }
statusline element that allows insertings arbitrary text as a status line element could be a more sustainable option?
I had a similar kind of thought of doing it as a theming option instead by having a Having a separate statusline element for adding icons would bring added annoyance when you want to have a background colour on the element you're styling. As an example the second picture in this PR, achieving that with a separate element would require that specific instance of the glyph element to be stylable and going to your theme to manually have it use the same colours as your |
We generally don't allow theming status-line elements individually currently. The only exception is the mode indicator but that is a special case as the color actually communicates additional information here (and is not just eye candy). I think the theming concern probably needs to be addressed separately and consistently across all components so that should be a separate PR and dropped here IMO. So for the time being adding a spacer element should work well and the spaces should be removed. On second thought adding an option for arbitrary text that prefixes the vcs status seems like a good thing to have though. It lets you know know what that text refers to on the statusline (and avoids the indicator doesn't stick around when there is no branch). This is consistent with other indicators (diagnostics, selection). This isn't necessarily about icons the prefix could also be My idea for arbitrary static status line text are probably better discussed separately and it's not entirely clear if we even want to add them right now. In general, it's sort of hard to draw a line with regard to statusline customization. The TOML config is a stopgap solution until we get a scripting language-based config. This would allow arbitrarily complex statusline customization. Until then we probably shouldn't make the statusline too generic/complex. |
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 is what implementing my comments would look like (ofcourse documentation and other code would need to be adjusted)
is this really the preferred solution how to get icons into all places in helix, compared to #2869? i really do not understand the push against it. |
Sure, I think having colours on the version-control element could have some other purpose besides just eye candy, like having it change colour based on if your repo state is dirty or if you're behind/ahead origin etc. But as you said, it would need to be a completely different PR altogether.
Yes, that's the primary reason I decided to do this originally, since having a ton of text on the statusline without any extra indicator for what it's related to, could be really confusing to look at. Without the theming aspect your suggested way is also fine, since the padding is only an issue when you set a different background colour from the statusline.
Totally agree, I don't think arbitrary text elements on the status line will have much use before there's a more moldable way to configure the statusline than just having an array in a TOML file. |
6f4ab6b
to
ab9e4bf
Compare
Removed theming functionality and implemented the suggested changes. Diff might be a bit messy since I rebased to master as well. |
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 great now 👍 Thanks for sticking with me trough my confused rambeling :D
we might actually want the default to be ofcourse we could just not have a default too but this seems inline with other elements to me |
ah yeah the colon is a nice addition. I like |
ab9e4bf
to
284b73c
Compare
version-control
statusline elementvcs:
prefix to version-control
statusline element
vcs:
prefix to version-control
statusline elementvcs:
prefix to version-control
statusline element
Please can |
It's configurable in |
Great! Please can you add this to the docs in this PR? https://docs.helix-editor.com/master/configuration.html Cheers. |
Ah yeah right I was so focused on how it should work that I forgot about the docs during review. This should be added to |
284b73c
to
ab35bb2
Compare
Right, forgot about that completely. Docs are now updated |
last try - i honestly believe that implementation of icons by overwriting dozens of (often duplicate) things named as |
Agree. Having icons configuration in one place is way more convenient. Something more general like #2869 would be better. |
Adds `config.toml` option `editor.statusline.version-control-prefix`, to allow adding a user-defined prefix to the branch name. This can be used to add an icon to the element. As an additional fix, if the HEAD name is empty the version-control element won't get drawn.
ab35bb2
to
535e015
Compare
Rebased to master since there were some conflicts due to other docs changes. Is this something that is still wanted or should we close this and have the behaviour be achievable through the plugin system once it's ready? |
Adds
config.toml
optioneditor.statusline.version-control-icon
, to allow adding a user-defined icon as a prefix to the branch name. Or any other string prefix if wanted.Also applies any styling defined under the key
ui.statusline.versioncontrol
.Example from the
![Screenshot 2023-04-07 at 19 30 15](https://user-images.githubusercontent.com/31644842/230644101-bfc45a1d-fb9d-48d6-a6fa-73ffc6e39031.png)
![Screenshot 2023-04-07 at 19 34 38](https://user-images.githubusercontent.com/31644842/230644577-2023c32d-3305-4068-81f3-0a7acd43f871.png)
kanagawa
theme that's been updated to use this new style option, with a Nerd Fonts branch icon.With background colour in the default theme.
As an additional fix, if the HEAD name is empty, the version-control element won't get drawn.