import { fn } from "https://deno.land/x/ddc_vim@v4.0.2/deps.ts";
const { synIDattr } = fn;
The result is a String, which is the {what} attribute of
syntax ID {synID}. This can be used to obtain information
about a syntax item.
{mode} can be "gui", "cterm" or "term", to get the attributes
for that mode. When {mode} is omitted, or an invalid value is
used, the attributes for the currently active highlighting are
used (GUI, cterm or term).
Use synIDtrans() to follow linked highlight groups.
{what} result
"name" the name of the syntax item
"fg" foreground color (GUI: color name used to set
the color, cterm: color number as a string,
term: empty string)
"bg" background color (as with "fg")
"font" font name (only available in the GUI)
highlight-font
"sp" special color for the GUI (as with "fg")
highlight-guisp
"ul" underline color for cterm: number as a string
"fg#" like "fg", but for the GUI and the GUI is
running the name in "#RRGGBB" form
"bg#" like "fg#" for "bg"
"sp#" like "fg#" for "sp"
"bold" "1" if bold
"italic" "1" if italic
"reverse" "1" if reverse
"inverse" "1" if inverse (= reverse)
"standout" "1" if standout
"underline" "1" if underlined
"undercurl" "1" if undercurled
"strike" "1" if strikethrough
"nocombine" "1" if nocombine
Returns an empty string on error.
Example (echoes the color of the syntax item under the cursor):
:echo synIDattr(synIDtrans(synID(line("."), col("."), 1)), "fg")
Can also be used as a method
:
:echo synID(line("."), col("."), 1)->synIDtrans()->synIDattr("fg")