Styling init.lua
#1400
Closed
justinrubek
started this conversation in
General
Replies: 2 comments 1 reply
-
The |
Beta Was this translation helpful? Give feedback.
1 reply
-
It looks like this ended up being implemented anyway in 21c2339. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Recently I was adapting some of my remaining lua configuration to live in nixvim (from #1392). I initially ran into issues that I was able to resolve by looking at the generated
init.lua
and eventually figuring out what the problem was. While I was doing that I thought "wow, this would be a lot easier if the file was formatted nicely" so I start digging into how things were generated.My first thought was that I could make a change to
toLuaObject
(and other places?) to output nicely. However, I thought that could become incredibly difficult after looking into it, especially given that the function is currently much easier to read than it would be if it had to worry about pretty-printing.I ended up making a change that runs a formatter on the generated init file. I also gated it behind a boolean option because, even though it is fast to perform, I could imagine that it isn't universally desired (although personally I'd prefer having less options and just defaulting to this behavior).
This generates much nicer looking init files, which I think is appealing for the above reasons, but also for the situation where someone may want to migrate away from nixvim, or to use a similar configuration somewhere they can't manage their editor through nix.
I'm writing to ask if this is something the project would be interested in taking. I'd rather not maintain even a small fork if it can be avoided.
Here's my initial draft of adding this justinrubek@2757cd2. I'm not particularly attached to
stylua
, that was just the one I chose to try this out.Beta Was this translation helpful? Give feedback.
All reactions