Closed Gremious closed 1 year ago
Ok after enough running different nestings of :lua print(vim.inspect(require("alpha.themes.dashboard")))
and a bit of source reading I think I figured out and already, and am leaving my answer for other people, cause there's not enough docs I say and the dichotomy between "groups" and "sections" is confusing to new users.
What are sections / Are they just groups? Yes - just a group, not special. See: https://github.com/goolord/alpha-nvim/blob/d2336550abec27c6af8be4ed5045fb4fa82a9c93/lua/alpha/themes/dashboard.lua#L75
When to prefer using them.
When you wanna group things together and maybe move them together.
You can insert more things at the end of existing sections in any regular lua way, e.g. with table.insert(config.layout.buttons, { ... })
(doc) or what not.
Can I make my own They are just a lua table, stored separately for convenience.
Would still like sections mentions in the docs, in relations to groups.
yeah, you have the right idea. I just wanted to provide a simpler api for doing small mutations to alpha themes, like changing the header text or something.
it's kinda a quirk of lua i suppose, the layout
array is really a table with number indexes, if you give them a string as the key it can sort the table in funny ways
Yeah that's reasonable, and honestly appreciated - now that I know what it does it does it makes sense.
I've read the documentation but it doesn't mention much about what sections are and how to use them.
It's all a bit confusing, since the layout map can take a mix of "sections" and arbitrary user elements together e.g.
but then the sections are pretty much fully configurable anyway?
Also the doc mention a
buttons
as well as atop_buttons
section (which also implies a bottom_buttons), though top_buttons isn't real anymore I think since I get a lua error on trying to use that. With that said:section.buttons
as opposed to just putting buttons in the layout?{ type = 'group', val = { ... } }
or are they treated in any special way by alpha? Asking because they seem to be in a separate field, outside oflayout
.Thanks 👍