1

The Conceal highlighting is not working properly when I edit a Vim help file. When I'm in insert mode on a line with concealed text, the concealed characters will be black on black. I can only see them if my cursor is on them. This is despite the Conceal highlight being defined as white on grey.

I've tested with Vim 8.2 on Cygwin and Vim 9.0 on Debian 12 with the same results.

How can I tell Vim to use the defined Conceal highlighting?

Steps to Reproduce

  1. Create the files listed below with the contents.
  2. Run vim -Nu NONE -S init.vim test.txt
  3. Enter :set ft=help
  4. Go to insert mode.

init.vim contents

filetype plugin indent on syntax enable set bg=dark 

text.txt contents

This is a *test* to see if |conceal| is working. 

Here's what I see in insert mode. I've placed my cursor on the first concealed character: enter image description here

Here's my highlight settings for Conceal: enter image description here

1 Answer 1

2

In your screenshot, no text is concealed!

This is because you are in insert mode, and the help ftplugin has set 'concealcursor' to nc so that concealed text is visible in insert and visual modes, to make it easier to edit.

Therefore, you're looking at the wrong highlight groups. The syntax groups you need to check are helpStar and helpBar, which in your test are linked to Ignore, making the characters "hidden" (presumably because normally when you view a help file you don't want to see those characters).

You can change this by highlighting those groups differently e.g.

:hi helpStar ctermfg=red guifg=red :hi helpBar ctermfg=green guifg=green 

So, you might ask, what is the Conceal highlight group for? Well, that is instead used for colouring the replacement characters used when you set a cchar for a concealed syntax item. (So for the example given in the linked docs, it would be used for colouring the ampersand character used when replacing & with &.)

The cchar feature isn't used at all in Vim's syntax file for the help filetype, so you won't see the Conceal highlighting anywhere in your test file.

1
  • Thanks for the detailed answer. Changing the highlighting for the groups you list fixed my problem. Commented Aug 12, 2023 at 3:55

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.