From 8ef3dd3afa20024f439d8b7a69f316069c1909d3 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 9 Oct 2024 19:31:14 +0800 Subject: 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 --- runtime/doc/lua.txt | 9 +++------ runtime/lua/vim/_options.lua | 4 +--- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 396f24a1aa..3e8d8bb62c 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -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() diff --git a/runtime/lua/vim/_options.lua b/runtime/lua/vim/_options.lua index a61fa61256..77d7054626 100644 --- a/runtime/lua/vim/_options.lua +++ b/runtime/lua/vim/_options.lua @@ -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 -- cgit