Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ddc_vim/deps.ts>fn.getbufvar

Dark deno-powered completion framework for neovim/Vim
Go to Latest
function fn.getbufvar
import { fn } from "https://deno.land/x/ddc_vim@v4.1.0/deps.ts";
const { getbufvar } = fn;

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)

Parameters

denops: Denops
varname: "" | "&"
optional
def: unknown

Returns

Promise<Record<string, unknown>>

Parameters

denops: Denops
varname: string
optional
def: unknown

Returns

Promise<unknown>