Skip to content
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

Customizable statusline #708

Closed
kirawi opened this issue Sep 4, 2021 · 18 comments
Closed

Customizable statusline #708

kirawi opened this issue Sep 4, 2021 · 18 comments
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements E-easy Call for participation: Experience needed to fix: Easy / not much E-good-first-issue Call for participation: Issues suitable for new contributors

Comments

@kirawi
Copy link
Member

kirawi commented Sep 4, 2021

Following some discussion on #649, it might be a good idea to allow for a configurable statusline through templating. We can borrow some code from here, and make some of the changes suggested by Blaz: 'We might be able to reuse that with some tweaking (lazy_static -> once_cell, disabling styles for now).'

@kirawi kirawi added C-enhancement Category: Improvements A-helix-term Area: Helix term improvements E-easy Call for participation: Experience needed to fix: Easy / not much labels Sep 4, 2021
@Omnikar
Copy link
Contributor

Omnikar commented Sep 4, 2021

What should be used in the template string to indicate the separation between the left and right sides of the statusline? Maybe {|}? Also, should we allow things to be in the center of the statusline?

@kirawi
Copy link
Member Author

kirawi commented Sep 4, 2021

Maybe we could use the alignment operators: <, >? It would just be relative to the left and right elements. Though I'm not sure how it would work in practice.

@Omnikar
Copy link
Contributor

Omnikar commented Sep 4, 2021

If we just use a "separator", such as {|}, like I mentioned, we can just allow left{|}center{|}right.

@kirawi
Copy link
Member Author

kirawi commented Sep 4, 2021

Sounds good.

@Omnikar
Copy link
Contributor

Omnikar commented Sep 4, 2021

Though we'd have to decide what to do if there are less than 2 separators present in the format string. I think:

  • 0: left
  • 1: left{|}right

If you wanted only left and center or right and center, you could do left{|}center{|} or {|}center{|}right. And center-only can be achieved via {|}center{|}.

Alternatively, we could just enforce two separators, but I'm not too fond of that idea.

@gbaranski
Copy link
Contributor

Or we could do

[statusline]
left = "editing {filename}"
center = "Date: {date}"
right = "LSP: {lsp-status}"

What do you think about that?

@kirawi
Copy link
Member Author

kirawi commented Sep 10, 2021

Conditional templating would also be interesting, e.g. #447. Maybe something like the C++ short hand if else statement ((condition) ? expressionTrue : expressionFalse) with some predefined conditions?

@gbaranski
Copy link
Contributor

I3status-rust does something similar to what we want. https://github.com/greshake/i3status-rust/blob/master/doc/blocks.md

@sudormrfbin
Copy link
Member

Maybe something like the C++ short hand if else statement ((condition) ? expressionTrue : expressionFalse) with some predefined conditions?

I think we want to avoid introducing constructs like that since it will probably spiral into injecting more and more logic handling into a plain toml file and before we know it we would have invented a mini language that's similar to most things out there but also very different from most things out there. It was also brought up in Matrix a while ago and there was a (more or less) general consensus that it's better left to when we have a proper plugin system in place which can be used to dynamically define the config file or an actual configuration programming language (lisps were of interest last time IIRC).

@kirawi kirawi added the E-good-first-issue Call for participation: Issues suitable for new contributors label Oct 2, 2021
@Omnikar
Copy link
Contributor

Omnikar commented Oct 14, 2021

Perhaps something that should be added as an option for a status line element: cursor count

@archseer
Copy link
Member

Ah yeah, that's something we should add to the default status line too.

@bestouff
Copy link

I'd like to have this kind of eye candy in the status bar possible:

image
Here we see the git branch, file name, modification status, git lines added/changed/removed, LSP errors/warnings, in-tree indicator, LSP server and lang, and "scrollbar" position.
As showed here it uses nerd fonts, so that probably requires a config item to degrade from nerd font to plain unicode.

@NNBnh
Copy link
Contributor

NNBnh commented Nov 27, 2021

This look like a status line from Emacs (nope), looking good! I have composed a list of component for the statusline taking from Kakoune, Vim's airline and that Emacs's line above:

  • Current position information:
    • Cursor line.
    • Cursor column.
    • Cursor display column.
    • Cursor position as a percentage of the whole file (a more simple approach to the "scrollbar position" that show on the Emacs screenshot).
    • Cursor count.
    • Current cursor number.
    • Search position (e.g: 10/20).
  • Current mode.
  • Buffer's line count.
  • Filename.
  • Filepath.
  • Read-only flag (Helix currently doesn't support read-only buffer).
  • Modification status.
  • File encoding (e.g: "utf-8").
  • Fileformat (e.g: "unix").
  • Filetype (LSP server and lang).
  • LSP errors/warnings.
  • VCS information (git added/changed/removed).
  • In-tree indicator (idk what this is...)

@bestouff
Copy link

This is the status line from Lunarvim (an easy to install full-fledged nvim config) but yeah.

@pickfire
Copy link
Contributor

One more which I find useful is the search position from doom emacs, 10/20 like that.

@hahanein
Copy link
Contributor

IntelliJ has a very simple status line configuration feature: https://www.jetbrains.com/webstorm/guide/tips/customize-status-bar/

It'd look a little like this:

// config.toml
[editor]
status-line = ["git-branch", "file-encoding", "search-position"]

VSCode is similarly restrictive. Furthermore, a plugin author may add status bar items using this API (alignment configurable).

In my mind this is really user friendly. Adding and removing features is straight-forward. No knowledge of a template language is required. No need to debug layouts (maybe less need to debug layouts).

If you want more control; if a plugin author wants to provide you with more control, they should be able to take full control over status line, though. However, in that case I'm not sure you'd want to impose restrictions such as the use of a specific template language or of specific alignment primitives (left, center, right).

A couple more data points:

@Zoybean
Copy link
Contributor

Zoybean commented May 3, 2022

One thing I liked from my vim config was displaying the hex value of the character under the (primary, in helix' case) cursor. I'd love to have that in helix

@kirawi
Copy link
Member Author

kirawi commented Nov 10, 2022

Resolved by #2434

@kirawi kirawi closed this as completed Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements E-easy Call for participation: Experience needed to fix: Easy / not much E-good-first-issue Call for participation: Issues suitable for new contributors
Projects
None yet
Development

No branches or pull requests

10 participants