mirror of
https://github.com/neovim/neovim.git
synced 2026-07-10 19:39:38 +00:00
feat(api): nvim_set_option_value(operation=...) #39849
Problem: `nvim_set_option_value` cannot "update" options similar to `:set opt=`, `:set opt+=`, etc. The Lua impls of "vim.opt" / "vim.o" have incomplete, bespoke reimplementations of those operations. ref #38420 Solution: - Add `operation` param to `nvim_set_option_value`, which may be "set", "append", "prepend", or "remove". - Use this feature to implement `vim.opt` / `vim.o`.
This commit is contained in:
6
runtime/lua/vim/_meta/api.gen.lua
generated
6
runtime/lua/vim/_meta/api.gen.lua
generated
@@ -2305,12 +2305,18 @@ function vim.api.nvim_set_option(name, value) end
|
||||
--- @param value any New option value
|
||||
--- @param opts vim.api.keyset.option Optional parameters
|
||||
--- - buf: Buffer number. Used for setting buffer local option.
|
||||
--- - dry_run: (`boolean?`, default: false) If true, then the
|
||||
--- option value won't be set.
|
||||
--- - operation: One of "set", "append", "prepend", or "remove".
|
||||
--- Corresponds to `:set=`, `:set+=`, `:set^=`, and `:set-=`.
|
||||
--- Default is "set".
|
||||
--- - scope: One of "global" or "local". Analogous to
|
||||
--- `:setglobal` and `:setlocal`, respectively.
|
||||
--- - tab: `tab-ID` for tab-local options (currently only 'cmdheight'). Tabpage 0
|
||||
--- means the current tabpage. If a non-current tab is given, the value will take
|
||||
--- effect when it is switched-to.
|
||||
--- - win: `window-ID`. Used for setting window local option.
|
||||
--- @return any # Option value
|
||||
function vim.api.nvim_set_option_value(name, value, opts) end
|
||||
|
||||
--- Sets a global (g:) variable.
|
||||
|
||||
2
runtime/lua/vim/_meta/api_keysets.gen.lua
generated
2
runtime/lua/vim/_meta/api_keysets.gen.lua
generated
@@ -381,7 +381,9 @@ error('Cannot require a meta file')
|
||||
|
||||
--- @class vim.api.keyset.option
|
||||
--- @field buf? integer
|
||||
--- @field dry_run? boolean
|
||||
--- @field filetype? string
|
||||
--- @field operation? string
|
||||
--- @field scope? string
|
||||
--- @field tab? integer
|
||||
--- @field win? integer
|
||||
|
||||
Reference in New Issue
Block a user