1

Is it possible to temporarily disable the text highlight under cursor?

The current highlight group can be obtained by synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name'). How to clear it to restore it later? One approach can be to save the match-pattern used for the highlight (obtain how?) and then clear the highlight group. While restoring the highlight, enable the cleared highlight group on the stored match-pattern.

Background

I want to reveal the concealed text around the cursor. On every CursorMoved event, I will locate the surrounding concealed text, store enough highlight info to re-conceal in future and clear the conceal-highlight (preferably clear only for the text under cursor).

2
  • Maybe better to toggle conceallevel? Or set concealcursor (? I forget the exact option) to not conceal in (for example) visual mode?
    – D. Ben Knoble
    Commented Aug 2, 2021 at 2:01
  • Dup: vi.stackexchange.com/q/11368/33130
    – tejasvi
    Commented Aug 11, 2021 at 12:42

1 Answer 1

0

getmatches() provides the match info including the pattern and match id. If the cursor location is included in the pattern match delete it using matchdelete().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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