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

statusline/lualine: extensible sections #173

Merged
merged 3 commits into from
Oct 25, 2023

Conversation

ksonj
Copy link
Contributor

@ksonj ksonj commented Oct 23, 2023

I have a usecase where I need to add an additional source to a section in the statusline. Since repeating and then extending the current defaults isn't very convenient, I've changed the type of activeSections and inactiveSections attributes to listOf str, added extraActiveSection and extraInactiveSection of the same type and then create a lua table from the concatentation of both settings in the config.

I immediately see two issues with this:

  1. I am breaking existing configurations that customize the lualine sections
  2. Having a nix-list of lua-values is a bit odd. Eg. adding a string would look like ``["'some_string'"]` 🤷

I'm not sure if (1.) is a problem. You're on 0.x still so I assume it's justifiable, but I'm of course willing to adapt this PR if you prefer a proper deprecation process or to keep the existing types.

For (2.) I think this somewhat is the nature of Nix but again I am willing to explore alternatives.

This adds extraActiveSection and extraInactiveSection to the lualine
options to make it possible to easily extend the defaults with
additional sections. We're also changing the exposed type of the
*activeSection attributes from `str` to `listOf str`.
@ksonj ksonj requested a review from NotAShelf as a code owner October 23, 2023 19:10
@NotAShelf
Copy link
Owner

I immediately see two issues with this:

1. I am breaking existing configurations that customize the lualine sections

2. Having a nix-list of lua-values is a bit odd. Eg. adding a string would look like ``["'some_string'"]` 🤷

I'm not sure if (1.) is a problem. You're on 0.x still so I assume it's justifiable, but I'm of course willing to adapt this PR if you prefer a proper deprecation process or to keep the existing types.

For (2.) I think this somewhat is the nature of Nix but again I am willing to explore alternatives.

(1.) is not really a problem. Breaking changes to be expected, such is the nature of improvement. I'll make a pinned issue describing the changes.

For (2.), it really is difficult to convert Nix to Lua in a way that it looks pretty. We already have some lua helpers, on top of the one in nixpkgs, and I am yet to see a converter that can make generated lua look good. We can think about the conversion method a little more, but as long as it's functional we should be good.

Copy link
Owner

@NotAShelf NotAShelf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Minor nitpick regarding the location of the function and type definitions, should be good afterwards.

@NotAShelf NotAShelf self-requested a review October 24, 2023 12:12
@NotAShelf NotAShelf merged commit 30552a9 into NotAShelf:main Oct 25, 2023
7 checks passed
@ksonj ksonj deleted the lualine-options branch October 25, 2023 21:57
bloxx12 pushed a commit to bloxx12/nvf that referenced this pull request Sep 29, 2024
statusline/lualine: extensible sections
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants