3 " Show the syntax group name of the item under cursor.
4 " map -a :call SyntaxAttr()<CR>
12 let id1 = synID(line("."), col("."), 1)
13 let tid1 = synIDtrans(id1)
15 if synIDattr(id1, "name") != ""
16 let synid = "group: " . synIDattr(id1, "name")
18 let synid = synid . '->' . synIDattr(tid1, "name")
20 let id0 = synID(line("."), col("."), 0)
21 if (synIDattr(id1, "name") != synIDattr(id0, "name"))
22 let synid = synid . " (" . synIDattr(id0, "name")
23 let tid0 = synIDtrans(id0)
25 let synid = synid . '->' . synIDattr(tid0, "name")
27 let synid = synid . ")"
31 " Use the translated id for all the color & attribute lookups; the linked id yields blank values.
32 if (synIDattr(tid1, "fg") != "" )
33 let guifg = " guifg=" . synIDattr(tid1, "fg") . "(" . synIDattr(tid1, "fg#") . ")"
35 if (synIDattr(tid1, "bg") != "" )
36 let guibg = " guibg=" . synIDattr(tid1, "bg") . "(" . synIDattr(tid1, "bg#") . ")"
38 if (synIDattr(tid1, "bold" ))
39 let gui = gui . ",bold"
41 if (synIDattr(tid1, "italic" ))
42 let gui = gui . ",italic"
44 if (synIDattr(tid1, "reverse" ))
45 let gui = gui . ",reverse"
47 if (synIDattr(tid1, "inverse" ))
48 let gui = gui . ",inverse"
50 if (synIDattr(tid1, "underline"))
51 let gui = gui . ",underline"
54 let gui = substitute(gui, "^,", " gui=", "")
58 let message = synid . guifg . guibg . gui
61 let message = "<no syntax group here>"