import { fn } from "https://deno.land/x/ddc_vim@v4.1.0/deps.ts";
const { gettabwinvar } = fn;
Get the value of window-local variable {varname} in window
{winnr} in tab page {tabnr}.
The {varname} argument is a string. When {varname} is empty a
dictionary with all window-local variables is returned.
When {varname} is equal to "&" get the values of all
window-local options in a Dictionary
.
Otherwise, when {varname} starts with "&" get the value of a
window-local option.
Note that {varname} must be the name without "w:".
Tabs are numbered starting with one. For the current tabpage
use getwinvar()
.
{winnr} can be the window number or the window-ID
.
When {winnr} is zero the current window is used.
This also works for a global option, buffer-local option and
window-local option, but it doesn't work for a global variable
or buffer-local variable.
When the tab, window or variable doesn't exist {def} or an
empty string is returned, there is no error message.
Examples:
:let list_is_on = gettabwinvar(1, 2, '&list')
:echo "myvar = " .. gettabwinvar(3, 1, 'myvar')
To obtain all window-local variables use:
gettabwinvar({tabnr}, {winnr}, '&')
Can also be used as a method
:
GetTabnr()->gettabwinvar(winnr, varname)