Syntax Detection

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Syntax Detection

jason heddings-2
Is it possible to determine (based on the cursor location) which syntax
elements are being matched?

i.e. if I were editing a C++ file and the cursor were in a string, I might
press a key to see "String,Constant" etc.

Thanks,
--jah

Reply | Threaded
Open this post in threaded view
|

Re: Syntax Detection

Nikolai Weibull-2
jason heddings wrote:

> Is it possible to determine (based on the cursor location) which
> syntax elements are being matched?

:echo synIDattr(synID(line('.'), col('.'), 0), 'name')

Enjoy,
        nikolai

--
Nikolai Weibull: now available free of charge at http://bitwi.se/!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}
Reply | Threaded
Open this post in threaded view
|

Re: Syntax Detection

Charles E Campbell Jr
In reply to this post by jason heddings-2
jason heddings wrote:

>Is it possible to determine (based on the cursor location) which syntax
>elements are being matched?
>
>i.e. if I were editing a C++ file and the cursor were in a string, I might
>press a key to see "String,Constant" etc.
>  
>

Take a look at: "How to tell what syntax highlighting group *that* is!":

http://vim.sourceforge.net/tips/tip.php?tip_id=99

Regards,
Chip Campbell

Reply | Threaded
Open this post in threaded view
|

RE: Syntax Detection

jason heddings-2
Works like a charm...  Especially the script...

 

-----Original Message-----
From: Charles E. Campbell, Jr. [mailto:[hidden email]]
Sent: Friday, 02 September, 2005 13:50
To: jason heddings
Cc: [hidden email]
Subject: Re: Syntax Detection

jason heddings wrote:

>Is it possible to determine (based on the cursor location) which syntax
>elements are being matched?
>
>i.e. if I were editing a C++ file and the cursor were in a string, I
>might press a key to see "String,Constant" etc.
>  
>

Take a look at: "How to tell what syntax highlighting group *that* is!":

http://vim.sourceforge.net/tips/tip.php?tip_id=99

Regards,
Chip Campbell