nvim-neorg / neorg

Modernity meets insane extensibility. The future of organizing your life in Neovim.
GNU General Public License v3.0
6.09k stars 204 forks source link

Feature request: color-coded undordered lists #884

Open hacker-DOM opened 1 year ago

hacker-DOM commented 1 year ago

Is it just me or do different levels of indentation for unordered lists kind of blend together? (The difference in their indentation is only 1 character...) Coming from Logseq, I'm used to using unord. lists extensively.

Is there any way we could use different colors for different levels, or find another way to visually separate them?

d-r-a-b commented 1 year ago

I definitely sympathize with multi-layered ordered lists not always being the most comprehensible, especially when you only have 1-2 items in a sublevel. There are multiple approaches to combat this, which are already baked into Neorg.

You can already use https://github.com/nvim-neorg/neorg/wiki/Concealer to set more distinct icons for your levels.

Alternatively, these are all exposed as different treesitter captures. hi @neorg.lists.unordered.1.prefix guifg=red is an example of how to use your colorscheme to accomplish what you are proposing. :TSCapturesUnderCursor for an easy way to figure out the capture groups, which are defined in https://github.com/nvim-neorg/neorg/blob/main/queries/norg/highlights.scm. The way to configure these in a more Neorg-appropriate manner would be configuring https://github.com/nvim-neorg/neorg/wiki/Core-Highlights.

Feel free to submit a PR if you feel the docs could be improved to better expose this functionality. Most of the docs are autogenerated from the comments in the source; in this case you would probably be looking at amending the comments in https://github.com/nvim-neorg/neorg/blob/main/lua/neorg/modules/core/concealer/module.lua or https://github.com/nvim-neorg/neorg/blob/main/lua/neorg/modules/core/highlights/module.lua.

leon-richardt commented 10 months ago

TL;DR: It seems the possibility to have highlight groups by indentation level was removed in https://github.com/nvim-neorg/neorg/commit/f1ecd613d9c2911c7f7d5abd7f6f471614d05518.


Tracking code paths and using `git-blame` Hi, I just tried the proposed syntax (`hi @neorg.lists.unordered.1.prefix guifg=red`) but alas, it didn't do anything. For context, `hi @neorg.lists.unordered.prefix guifg=red` works as expected but it changes the highlight groups for *all* indentation levels. Looking at the code (my Lua knowledge is limited so please excuse me if I'm wrong), it seems like no distinction is made based on indentation levels for lists: https://github.com/nvim-neorg/neorg/blob/f296a22864bbac0d94ad00fa18cc8231dbeaa1e3/lua/neorg/modules/core/highlights/module.lua#L180-L184 Compare that to the definition of quote highlight groups for different indent levels here: https://github.com/nvim-neorg/neorg/blob/f296a22864bbac0d94ad00fa18cc8231dbeaa1e3/lua/neorg/modules/core/highlights/module.lua#L187-L212 --- So, I guess my question is this: Am I doing something wrong or are list highlight groups for different indentation levels just not supported? **EDIT 1:** Looking at the query definitions, it seems like the relevant capture groups are simply not assigned to the respective highlight groups (again, compare to the quote definitions right below): https://github.com/nvim-neorg/neorg/blob/f296a22864bbac0d94ad00fa18cc8231dbeaa1e3/queries/norg/highlights.scm#L182-L188