folke / twilight.nvim

🌅 Twilight is a Lua plugin for Neovim 0.5 that dims inactive portions of the code you're editing using TreeSitter.
Apache License 2.0
1.24k stars 21 forks source link

Better Dimming with Markdown Files? #16

Closed FOSSilizedDaemon closed 1 month ago

FOSSilizedDaemon commented 3 years ago

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?

Hubro commented 2 years ago

Have you tried tweaking the context config option?

FOSSilizedDaemon commented 2 years ago

Have you tried tweaking the context config option?

The issue is sometimes I have more than X lines I need to highlight around the current line.

TymekDev commented 2 years ago

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

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 1 month ago

This issue was closed because it has been stalled for 7 days with no activity.