Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

btv.option

btv.option.set(name, value, opts)

btv.option.set(name, value, opts) [alias nvim_set_option_value]: set an option in the scope its name implies. A window-local option (number/relativenumber) — or any option with an explicit opts.win — routes through btv.wo (the targeted window, else the current one); otherwise it routes through btv.bo (opts.buf, else the current buffer). The wired options reach the core; everything else lands in the observable per-scope store. (The scoped tables btv.o / btv.bo / btv.wo are the primary option API; this is the by-name funnel plugins reach for.)

opts.scope is neovim’s local/global selector over the two tiers a buffer- or window-local option carries: "local" writes only the targeted instance (:setlocal), "global" only the value a new buffer is born from (:setglobal). Any other value fails loud. With no opts.scope and no opts.buf / opts.win, this is a plain :set and writes both — matching neovim, and the reason nvim_set_option_value("tabstop", 3, {}) in a config reaches the files you open afterwards rather than only the buffer that was current while it ran. Naming a buf / win narrows it back to that instance.

Defined in state.lua.

btv.option.get(name, opts)

btv.option.get(name, opts) [alias nvim_get_option_value]: read an option from the scope its name implies (see btv.option.set), so a wired option reflects the core’s current value (default until set). opts.scope = "global" reads the :setglobal tier instead; a read with no scope is the local value (neovim’s default for the getter, where the setter’s is :set).

Defined in state.lua.