lukas-reineke / headlines.nvim

This plugin adds horizontal highlights for text filetypes, like markdown, orgmode, and neorg.
MIT License
688 stars 28 forks source link

feat: allow highlighting only the heading marker chars #56

Closed cultab closed 1 year ago

cultab commented 1 year ago

Allows highlighting only the characters marking the headline.

For example with the new option disabled(enabled by default to avoid breaking changes):

### Heading

Will only highlight the 3 '#' chars.


I've made an attempt at documenting the changes.

Also this option does not /really/ make much sense with fat headlines, so it only kicks in when the new option and fat_headlines are set to false.

Whole lines turned off (also fat headlines turned off)

new behavior

image

Whole lines turned on

existing and default behavior

image

lukas-reineke commented 1 year ago

Thank you, but if you just want to change the foreground color of the headline marker, you can do this much easier with treesitter out of the box. The headline marker is its own node that you can target.

Create a file in your runtime path queries/markdown/highlights.scm

; extends

(atx_h1_marker) @H1Marker
(atx_h2_marker) @H2Marker
; ... add however many levels you want

Then then define the highlight groups :highlight @H1Marker guifg=#ff00ff

cultab commented 1 year ago

Thank you, but if you just want to change the foreground color of the headline marker, you can do this much easier with treesitter out of the box. The headline marker is its own node that you can target.

Create a file in your runtime path queries/markdown/highlights.scm

; extends

(atx_h1_marker) @H1Marker
(atx_h2_marker) @H2Marker
; ... add however many levels you want

Then then define the highlight groups :highlight @H1Marker guifg=#ff00ff

hahaha, I assumed you could do something like this but couldn't figure it out. Thank you!