Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Additional Configuration Options for Statusline Elements #12922

Closed
nouritsu opened this issue Feb 20, 2025 · 0 comments
Closed

Additional Configuration Options for Statusline Elements #12922

nouritsu opened this issue Feb 20, 2025 · 0 comments
Labels
C-enhancement Category: Improvements

Comments

@nouritsu
Copy link

Description

Currently the statusline in Helix does everything I want it to. Namely display information about

  • Editor State (mode, cursor position, active selections etc.)
  • File Information (name, encoding, line endings, language etc.)
  • LSP Information (spinner for status, file reports and workspace reports)

I settled on the following configuration for statusline

[editor.statusline]
center = [
    "file-encoding",
    "file-type",
    "file-line-ending",
    "separator",
    "file-name",
    "read-only-indicator",
    "separator",
    "spacer",
    "version-control",
    "file-modification-indicator",
]
left = [
    "mode",
    "selections",
    "primary-selection-length",
    "separator",
    "position",
    "position-percentage",
]
right = ["spinner", "diagnostics", "separator", "workspace-diagnostics"]

[editor.statusline.mode]
insert = "INSERT"
normal = "NORMAL"
select = "SELECT"

Improvement

I would like additional configuration options (with sensible defaults, of course) for the different "elements" in the statusline (similar to Starship). This would open up several configuration possiblities that would serve to improve the looks and functionality of the statusline.

Custom Format

On the left side of my statusline I have
Image
Here, I do not like the way the selections and primary-selection-length "elements" are rendered. I would like to define a custom format for the render. Something like -

[editor.statusline.selections]
format = "$count"

Which would then only render the count, eg - 5 rather than 5 sel

Note that this would not only help with decluttering/theming but also allow for reactive separators.
For example, to the right I have
Image
This, is quite ugly. However, that is only because there are no diagnostics in my workspace/file. When the workspace is populated with a few errors, the statusline looks like
Image
Which looks nice.

Adding in a format option would allow me to do something like

[editor.statusline.workspace-diagnostics]
format = "$separator W $diag_err $diag_warn $diag_info $diag_hint"

Which would only render the separator if the workspace-diagnostics element was also rendered.

Custom Color

In the center I have
Image
This would look a lot better if the different elements were of a different color.

Something like

[editor.statusline.version-control]
fg = "bold green"

The bg key will be inherited from statusline color since it is not set here.

Always Render

An always render option would solve the problem of the statusline looking odd when components are expected to render, but are kept hidden.

For example -

  • File encoding being hidden if non UTF-8
  • Spinner not being rendered when LSP is idle (could be replaced with an icon, maybe the language icon feat: add basic support for icons #12369)
  • Diagnostics for both file and workspace not rendering if 0. I know it would get quite cluttered if the statusline just had ● 0 ● 0 ● 0 ● 0 │ W ● 0 ● 0 ● 0 ● 0. But something like ● 0 | W ● 0 would look nice or even ● | W ● (green dots)

Miscellaneous Options

There are several more options that I would like to configure for the statusline. An example is described below.

The git_branch element from Starship perfectly explains what I would like to see. It provides the user with a key which removes the git_branch plugin from the prompt if the current branch is equal to a few values. For example, for helix

[editor.statusline.version-control]
ignored = ["main", "master"]

This would make it so that statusline only shows the branch if it is not equal to "main" or "master".

@nouritsu nouritsu added the C-enhancement Category: Improvements label Feb 20, 2025
@helix-editor helix-editor locked and limited conversation to collaborators Feb 20, 2025
@the-mikedavis the-mikedavis converted this issue into discussion #12924 Feb 20, 2025

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
C-enhancement Category: Improvements
Projects
None yet
Development

No branches or pull requests

1 participant