docs(lua): clarify when vim.bo/vim.wo acts like :setlocal (#27708)

This commit is contained in:
Luna Saphie Mittelbach 2024-03-04 00:33:09 +01:00 committed by GitHub
parent 181b620580
commit 3df1211ebc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 13 deletions

View File

@ -1409,11 +1409,12 @@ Option:remove({value}) *vim.opt:remove()*
• {value} (`string`) Value to remove • {value} (`string`) Value to remove
vim.bo *vim.bo* vim.bo *vim.bo*
Get or set buffer-scoped |options| for the buffer with number {bufnr}. Get or set buffer-scoped |options| for the buffer with number {bufnr}. If
Like `:set` and `:setlocal`. If [{bufnr}] is omitted then the current [{bufnr}] is omitted then the current buffer is used. Invalid {bufnr} or
buffer is used. Invalid {bufnr} or key is an error. key is an error.
Note: this is equivalent to both `:set` and `:setlocal`. Note: this is equivalent to `:setlocal` for |global-local| options and
`:set` otherwise.
Example: >lua Example: >lua
local bufnr = vim.api.nvim_get_current_buf() local bufnr = vim.api.nvim_get_current_buf()
@ -1462,9 +1463,10 @@ vim.o *vim.o*
vim.wo *vim.wo* vim.wo *vim.wo*
Get or set window-scoped |options| for the window with handle {winid} and Get or set window-scoped |options| for the window with handle {winid} and
buffer with number {bufnr}. Like `:setlocal` if {bufnr} is provided, like buffer with number {bufnr}. Like `:setlocal` if setting a |global-local|
`:set` otherwise. If [{winid}] is omitted then the current window is used. option or if {bufnr} is provided, like `:set` otherwise. If [{winid}] is
Invalid {winid}, {bufnr} or key is an error. omitted then the current window is used. Invalid {winid}, {bufnr} or key
is an error.
Note: only {bufnr} with value `0` (the current buffer in the window) is Note: only {bufnr} with value `0` (the current buffer in the window) is
supported. supported.

View File

@ -271,10 +271,10 @@ vim.go = setmetatable({}, {
}) })
--- Get or set buffer-scoped |options| for the buffer with number {bufnr}. --- Get or set buffer-scoped |options| for the buffer with number {bufnr}.
--- Like `:set` and `:setlocal`. If [{bufnr}] is omitted then the current --- If [{bufnr}] is omitted then the current buffer is used.
--- buffer is used. Invalid {bufnr} or key is an error. --- Invalid {bufnr} or key is an error.
--- ---
--- Note: this is equivalent to both `:set` and `:setlocal`. --- Note: this is equivalent to `:setlocal` for |global-local| options and `:set` otherwise.
--- ---
--- Example: --- Example:
--- ---
@ -287,9 +287,9 @@ vim.go = setmetatable({}, {
vim.bo = new_buf_opt_accessor() vim.bo = new_buf_opt_accessor()
--- Get or set window-scoped |options| for the window with handle {winid} and --- Get or set window-scoped |options| for the window with handle {winid} and
--- buffer with number {bufnr}. Like `:setlocal` if {bufnr} is provided, like --- buffer with number {bufnr}. Like `:setlocal` if setting a |global-local| option
--- `:set` otherwise. If [{winid}] is omitted then the current window is --- or if {bufnr} is provided, like `:set` otherwise. If [{winid}] is omitted then
--- used. Invalid {winid}, {bufnr} or key is an error. --- the current window is used. Invalid {winid}, {bufnr} or key is an error.
--- ---
--- Note: only {bufnr} with value `0` (the current buffer in the window) is --- Note: only {bufnr} with value `0` (the current buffer in the window) is
--- supported. --- supported.