[mini.pick] Show framework with syntax highlighting #2377
drowning-cat
started this conversation in
Show and tell
Replies: 1 comment
|
Thanks for sharing! That's a massive amount of work! Yeah, this is indeed a bit too complex for 'mini.pick' itself. But it's good to have a hobby to tweak a Neovim config to this degree, I guess :) |
0 replies
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.
Uh oh!
There was an error while loading. Please reload this page.
Related
Similar
Description
I abstracted
source.showas far as I could. I doubt someone in their right mind would use this code, but it's fun to try.The framework focuses on highlighting and alignment, and is designed so you don't have to deal with
extmarksoffsets manually, much like howsnacks.nvimhandles it.Note
Code highlighting is powered by Treesitter, so you'll need to configure it yourself.
Here is an example configuration:
Format options:
sep: string→ used as a separator between slots.tab: boolean→ to align slots by a separator using additional padding.Slot options:
align: "left"|"right"→ text alignment inside the slot.min: integer→ is the minimal slot length.A Slot is the smallest unit of abstraction and is represented as a simple table. Chunks use offsets relative to the
text(colandend_coldefault to the text boundaries).{ align = "left", min = 0, chunks = { { text = "some word", extms = { { col = 6, end_col = 9, hl_group = "ErrorMsg" } } }, { ... }, } }Predefined Slots 📦:
Slot.text(text, hl_group, opts)Any textSlot.path(path)Displayed pathSlot.num(lnum)Number (lnum/col)Slot.buf_lnum(buf, lnum)Highlighted line from the bufferSlot.code(code, path?, ft?)Highlighted code stringCode
The code is split across a few files, following the
plugin/structure while also using thelua/directory.There are three files:
plugin/30_mini_pick.lualua/share/mini_pick.lualua/util/highlight.luaCode is here (click me)
All reactions