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

后端 未结 4 1203
粉色の甜心
粉色の甜心 2020-12-15 05:28

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 Firebu

4条回答
  •  独厮守ぢ
    2020-12-15 06:26

    Try this:

    " diagnostics {{{
    if has('balloon_eval')
        nnoremap            : setl beval!
        set bexpr=InspectSynHL()
    endif
    fun! InspectSynHL()
        let l:synNames = []
        let l:idx = 0
        for id in synstack(v:beval_lnum, v:beval_col)
            call add(l:synNames, printf('%s%s', repeat(' ', idx), synIDattr(id, 'name')))
            let l:idx+=1
        endfor
        return join(l:synNames, "\n")
    endfun
    "}}}
    

提交回复
热议问题