vim-vue icon indicating copy to clipboard operation
vim-vue copied to clipboard

Highlighting of paragraphs on multiple lines in pug

Open blacksails opened this issue 6 years ago • 4 comments

On all lines but the first one the first word in a multiline paragraph is highlighted in bold.

See line 4, 5 and 6 of the following screenshot:

image

I tried to reproduce it in a pure .pug file with no luck, so i figure it must be related to vim-vue.

blacksails avatar Jul 28 '18 18:07 blacksails

Also having the same issue, any solutions?

clem109 avatar Dec 15 '18 18:12 clem109

This is because vim-vue has a rule to highlight any tag name, so that Vue component names are also highlighted.

https://github.com/posva/vim-vue/blob/e306929b27bea08ab505de7a4617e642b56b6dcd/syntax/vue.vim#L10-L11

I can see if I can disable this behavior for pug templates.

adriaanzon avatar Dec 15 '18 23:12 adriaanzon

I think this can be solved by changing the lines mentioned above into this:

syntax match vueComponentName contained "\<[a-zA-Z0-9:-]*\>" containedin=htmlTagN
highlight default link vueComponentName htmlTagName

Instead of overriding htmlTagName group, it creates a new group called vueComponentName and gives it the same color as htmlTagName.

Though i'm not so familiar with pug. Is it possible to include another Vue component inside a pug template? Because this will disable highlighting of all custom tag names inside pug templates.

adriaanzon avatar Dec 16 '18 00:12 adriaanzon

p.
    When I open a buffer and set the filetype to "pug",
    and then when I begin the lines with html tag names like this
    a foo bar
    div foo bar
    the html tag names get highlighted too.

So this may be a bug in vim-pug. Again, I'm not familiar with pug, so I don't know if the above example is valid pug code or not.

adriaanzon avatar Dec 16 '18 00:12 adriaanzon