import { getbufvar } from "https://deno.land/x/denops_std@v5.0.2/function/buffer.ts";
The result is the value of option or local buffer variable
{varname} in buffer {buf}. Note that the name without "b:"
must be used.
The {varname} argument is a string.
When {varname} is empty returns a Dictionary
with all the
buffer-local variables.
When {varname} is equal to "&" returns a Dictionary
with all
the buffer-local options.
Otherwise, when {varname} starts with "&" returns the value of
a buffer-local option.
This also works for a global or buffer-local option, but it
doesn't work for a global variable, window-local variable or
window-local option.
For the use of {buf}, see bufname()
above.
When the buffer or variable doesn't exist {def} or an empty
string is returned, there is no error message.
Examples:
:let bufmodified = getbufvar(1, "&mod")
:echo "todo myvar = " .. getbufvar("todo", "myvar")
Can also be used as a method
:
GetBufnr()->getbufvar(varname)