vim

How to get group name of highlighting under cursor in vim?


I usually customize existing colorscheme to meet my needs.

If I could get the syntax group name under cursor, it would help me a lot, just like Firebug but in Vim. I'd like to know how to do it.


Solution

  • There is this function that was floating around the web when I was doing the same thing:

    function! SynStack()
      if !exists("*synstack")
        return
      endif
      echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
    endfunc