import { synID } from "https://deno.land/x/denops_std@v5.0.2/function/mod.ts";
The result is a Number, which is the syntax ID at the position
{lnum} and {col} in the current window.
The syntax ID can be used with synIDattr()
and
synIDtrans()
to obtain syntax information about text.
{col} is 1 for the leftmost column, {lnum} is 1 for the first
line. 'synmaxcol' applies, in a longer line zero is returned.
Note that when the position is after the last character,
that's where the cursor can be in Insert mode, synID() returns
zero. {lnum} is used like with getline()
.
When {trans} is TRUE
, transparent items are reduced to the
item that they reveal. This is useful when wanting to know
the effective color. When {trans} is FALSE
, the transparent
item is returned. This is useful when wanting to know which
syntax item is effective (e.g. inside parens).
Warning: This function can be very slow. Best speed is
obtained by going through the file in forward direction.
Returns zero on error.
Example (echoes the name of the syntax item under the cursor):
:echo synIDattr(synID(line("."), col("."), 1), "name")