docs(lua): "vim.bo" is always equivalent to :setlocal (#30733)

vim.bo

    :lua vim.bo.textwidth = 80
    :setglobal textwidth?
      textwidth=0

:setlocal

    :setlocal textwidth=80
    :setglobal textwidth?
      textwidth=0

:set

    :set textwidth=80
    :setglobal textwidth?
      textwidth=80
This commit is contained in:
zeertzjq
2024-10-09 19:31:14 +08:00
committed by GitHub
parent 0264870c0a
commit 8ef3dd3afa
2 changed files with 4 additions and 9 deletions

View File

@ -1464,12 +1464,9 @@ Option:remove({value}) *vim.opt:remove()*
• {value} (`string`) Value to remove
vim.bo[{bufnr}] *vim.bo*
Get or set buffer-scoped |options| for the buffer with number {bufnr}. If
{bufnr} is omitted then the current buffer is used. Invalid {bufnr} or key
is an error.
Note: this is equivalent to `:setlocal` for |global-local| options and
`:set` otherwise.
Get or set buffer-scoped |options| for the buffer with number {bufnr}.
Like `:setlocal`. If {bufnr} is omitted then the current buffer is used.
Invalid {bufnr} or key is an error.
Example: >lua
local bufnr = vim.api.nvim_get_current_buf()

View File

@ -274,11 +274,9 @@ vim.go = setmetatable({}, {
})
--- Get or set buffer-scoped |options| for the buffer with number {bufnr}.
--- If {bufnr} is omitted then the current buffer is used.
--- Like `:setlocal`. If {bufnr} is omitted then the current buffer is used.
--- Invalid {bufnr} or key is an error.
---
--- Note: this is equivalent to `:setlocal` for |global-local| options and `:set` otherwise.
---
--- Example:
---
--- ```lua