twilight.nvim
twilight.nvim copied to clipboard
Better Dimming with Markdown Files?
I am loving using Twilight, but I have noticed that in markdown files Twilight does not proper see the see the beginning or end of each block. For example here you can see it highlight two blocks instead of just one. Is there anything I can do to get it to only highlight one block?
Have you tried tweaking the context config option?
Have you tried tweaking the
contextconfig option?
The issue is sometimes I have more than X lines I need to highlight around the current line.
I have also experienced a bit awkward dimming in markdown. I have set context to 0 and you can see results below.
I found out that using tree-sitter playground setting I could provide sensible values to expand option in Twilight config. These three values fix make entire paragraph, code block, and list highlighted.
require("twilight").setup({
context = 0,
expand = {
-- markdown
"paragraph",
"fenced_code_block",
"list",
}
})
I am a bit concerned about possible naming collision in tree-sitter nodes, but I have no clue if it is a valid concern. If it is, then perhaps expand could be extended to provide values per filetype?
Default config with context = 0
Section and paragraph

Code block

List
