tanloong
tanloong

Reputation: 66

Is there a way to get highlight group of the char under the cursor in (neo)vim?

In a plaintext buffer I have many words highlighted by :call matchadd(<group>, <pattern>) in different highlight groups. Is there a way to get the group name of cursor char?

:hlID()does not accepts cursor position args, it asks for highlight group name as its arg and returns highlight ID.:synID() accepts cursor position args but it does not work because it is for syntax highlight, not match highlight. And as it is plaintext buffer, :Inspect in neovim gives 'no items found at position x,y in buffer i'.

Upvotes: 2

Views: 124

Answers (0)

Related Questions