enter image description here

I expected the folded text highlighted as below picture (ignore red rectangle): enter image description here

Like above picture, I'd like to have something to recognize that red region of a fold and highlight it only, donot have ctermbg apply to the redundant spaces region.

This question is kind of general, I don't have much experience so I try to explain from user perspective, I'd like to have that red region highlighted only that is a folded block of text.

Thanks in advanced.

  • can you show us picture as it is and another one as it should be? – Maxim Kim Nov 6 '18 at 13:10
  • @MaximKim: I've just update the picture of expected folded text. Don't count the red rectangle. – Tuyen Pham Nov 6 '18 at 13:19
  • Ok, it is clear now. I don't think it is possible though. – Maxim Kim Nov 6 '18 at 13:25

That is not possible.

The folded text always uses the highlighting group Folded for the complete screen line.

However, you can of course change the highlighting group so that it doesn't stand out so much.

For example remove the background attribute of the Folded group to make only the text standout (or you could use a background attribute that doesn't have such a big contrast to the Normal highlighting group:

hi Folded ctermfg=102 guifg=#878787 guibg=NONE ctermbg=NONE

Note, that this might make it hard to realize that this is actually folded text as can be seen here:enter image description here

| improve this answer | |
  • Is there a way to check if it's folded or not and then matchgroup against it and use custom highlight? Remove ctermbg is not the way because I need it highlighted. – Tuyen Pham Nov 6 '18 at 16:28
  • sorry, I don't understand what you like to do – Christian Brabandt Nov 6 '18 at 16:28
  • I only need remove ctermbg on redundant spaces but keep on the text. – Tuyen Pham Nov 6 '18 at 16:29
  • @TuyenPham as I said at the beginning of my answer, that is not possible – Christian Brabandt Nov 7 '18 at 6:26
  • 1
    there are various functions to be used for checking if a line is folded or not, see :h function-list. However, that won't let you do what you want. The highlighting group is global, once you change it, it will take effect for all windows, buffers and all characters in each fold – Christian Brabandt Nov 7 '18 at 6:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.