vim-pandoc-syntax icon indicating copy to clipboard operation
vim-pandoc-syntax copied to clipboard

Change or remove certain syntax highlighting

Open simon50 opened this issue 8 years ago • 8 comments

I'm wondering if it's possible to change the color of elements or remove highlighting from them altogether. The thing is that I don't use concealing and what's left instead always turns orange. The headers will have '#'s in orange but the text in pink. Bold and italic text will have the the text italicized or in my bold color but the surrounding asterisks in orange. I'd like to have them white, like the ordinary text. And I'd like the '#'s in front of a header pink like the header. Is there any way to do this? I can't find it in the documentation.

simon50 avatar Nov 15 '17 21:11 simon50

The concealed characters are linked to Operator, you can override the Operator highlighting to get this effect. We don't do this because it changes external user configuration.

(I want to simplify the syntax highlighting at some point, but it's not in my short term plans for now.)

fmoralesc avatar Nov 16 '17 07:11 fmoralesc

How do I override the Operator highlighting?

simon50 avatar Nov 16 '17 13:11 simon50

I assume its vim-operator-highlight we're talking about. In the readme it suggests setting for example g:ophigh_filetypes_to_ignore.markdown = 1 to ignore markdown files. I set let g:ophigh_filetypes_to_ignore.pandoc = 1 in my .vimrc but it didn't fix it. I only get an error message saying:

E121: Undefined variable: g:ophigh_filetypes_to_ignore

which I guess means I don't have that plugin. It's not listed when I run :scriptnames either.

simon50 avatar Nov 23 '17 13:11 simon50

No, I meant only to do something like

hi! link Operator Normal

which overrides the highlights given by the colorscheme. The concealed characters use the Operator highlighting when shown. The command above makes that look like a normal character (without highlighting)

fmoralesc avatar Nov 23 '17 14:11 fmoralesc

Executing it inside vim does work but putting it .vimrc doesn't have any effect, for some reason.

The result is pretty much what I wanted. I'd like the asterisks used for bullet points to have their own color (now they're the text color) and the '#':s in front of headings to be pink like the rest of the header instead of the text color but it's better now than before. Thanks.

simon50 avatar Nov 23 '17 14:11 simon50

I guess it's set to on after .vimrc is applied. Making an autocmd fixes it. Like this:

au FileType pandoc hi! link Operator Normal

simon50 avatar Nov 23 '17 22:11 simon50

It can be overridden by the colorscheme, so you have to add that after you set it.

You can see what script sets it by checking the output of

verbose hi Operator

fmoralesc avatar Nov 23 '17 22:11 fmoralesc

I found something in vim-pandoc-syntax/syntax/pandoc.vim that looked like it could be relevant to the missing colors. Line 505 has:

hi link pandocAtxStart Operator

and line 539-540:

hi link pandocListItemBullet Operator
hi link pandocUListItemBullet Operator

I don't know all about how "hi" and "link" works but I figured if I "linked" these things to something more approriate the colors would change:

au FileType pandoc hi! link PandocAtxStart Title
au FileType pandoc hi! link pandocListItemBullet Identifier
au FileType pandoc hi! link pandocUListItemBullet Identifier

This didn't make any difference at all. I got it working by first setting these things to random specific colors, like this:

au Filetype pandoc hi! pandocAtxStart ctermfg=red
au FileType pandoc hi! pandocListItemBullet ctermfg=blue
au FileType pandoc hi! pandocUListItemBullet ctermfg=blue

and then having the lines from before underneath that. After that the syntax highlighting was beautiful again.

simon50 avatar Nov 27 '17 08:11 simon50