Skip to main content
Module

x/denops_std/function/buffer.ts>getbufvar

📚 Standard module for denops.vim
Go to Latest
function getbufvar
import { getbufvar } from "https://deno.land/x/denops_std@v6.4.0/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)

Parameters

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

Returns

Promise<Record<string, unknown>>

Parameters

denops: Denops
varname: string
optional
def: unknown

Returns

Promise<unknown>