Tuesday, February 12, 2019

Re: how to display current syntax and highlight items

Marvin Renich <mrvn@renich.org> wrote:

> I have looked through index.txt (especially g commands), syntax.txt, and
> usr_06.txt, but I could not find any reference to displaying the name of
> the current syntax item and/or highlight item of the character under the
> cursor. I am pretty sure that there was a tip about this on this list
> in the distant past, but cannot find it. Can anyone point me to the
> correct help tag?

In my ~/.vimrc, I have this to display the syntax group under
the cursor in the statusline:

" Function used to display syntax group.
function! SyntaxItem()
return synIDattr(synID(line("."),col("."),1),"name")
endfunction

And my statusline has this among other things:

set statusline+=%{SyntaxItem()}

Regards
Dominique

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: