Skip to main content
Module

x/denops_std/function/buffer.ts>setbufvar

📚 Standard module for denops.vim
Go to Latest
function setbufvar
import { setbufvar } from "https://deno.land/x/denops_std@v6.4.0/function/buffer.ts";

Set option or local variable {varname} in buffer {buf} to {val}. This also works for a global or local window option, but it doesn't work for a global or local window variable. For a local window option the global value is unchanged. For the use of {buf}, see bufname() above. The {varname} argument is a string. Note that the variable name without "b:" must be used. Examples:

:call setbufvar(1, "&mod", 1)
:call setbufvar("todo", "myvar", "foobar")

This function is not available in the sandbox.

Can also be used as a method, the base is passed as the third argument:

GetValue()->setbufvar(buf, varname)

Parameters

denops: Denops
varname: string
val: unknown

Returns

Promise<void>