Using Go templates to customize the ruler #2084
joelim-work
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
From discussion in #2057
Currently the ruler at the bottom can be customized using the
statfmt
andrulerfmt
options. While these options contain some level of flexibility, there are still some limitations when it comes to customization:statfmt
could not be drawn on the right side of the screen, and similarlyrulerfmt
components could not be drawn on the left side of the screen.The PR #2083 changes this to use Go templates instead to provide greater flexibility for customization, with the syntax being closer to a programming language instead of a format string. The tradeoff for the extra customizability is that the configuration is now more complex, which increases the barrier of entry for users.
To illustrate the history of the ruler configation:
ruler
option was added in Customizable statusline, df #1168, which allowed users to choose which fields to display and in which order:rulerfmt
in Addrulerfmt
option for improved ruler customization #1386 to allow for custom formatting:ruler
file looks like this:Each step allows for greater flexibility in customization, but at the same time results in more complex syntax.
Another suggestion would be to use a scripting language like Lua for handling the configuration, but then that requires using some 3rd party library (as opposed to the standard library), and the implementation would be even more complex as the API has to bridge between Lua and Go. I am probably not interested in taking things that far.
Anyway this is an idea that I want to suggest, hopefully it is not too confusing for users.
Beta Was this translation helpful? Give feedback.
All reactions