diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2026-07-13 14:35:23 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-13 14:35:23 -0400 |
| commit | 4d736cd41feb863274ccc73cf9e10407bdddd913 (patch) | |
| tree | 77901d36212bdfa057773f228bce83ec4137679d /runtime/lua/vim | |
| parent | dc8934482e72cdc885da69f7318eabc21a4e8757 (diff) | |
| parent | fe794153ed3f267bfba13b78fde67b999fe7e600 (diff) | |
| download | rneovim-4d736cd41feb863274ccc73cf9e10407bdddd913.tar.gz rneovim-4d736cd41feb863274ccc73cf9e10407bdddd913.tar.bz2 rneovim-4d736cd41feb863274ccc73cf9e10407bdddd913.zip | |
Merge #40721 from justinmk/refactor
Diffstat (limited to 'runtime/lua/vim')
31 files changed, 104 insertions, 104 deletions
diff --git a/runtime/lua/vim/_comment.lua b/runtime/lua/vim/_comment.lua index 7afd0813ca..dbc2f38b34 100644 --- a/runtime/lua/vim/_comment.lua +++ b/runtime/lua/vim/_comment.lua @@ -68,7 +68,7 @@ local function get_comment_parts(ref_position) local cs = get_commentstring(ref_position) if cs == nil or cs == '' then - vim.api.nvim_echo({ { "Option 'commentstring' is empty.", 'WarningMsg' } }, true, {}) + vim.api.nvim_echo({ { "Option 'commentstring' is empty.", 'WarningMsg' } }, true) return { left = '', right = '' } end diff --git a/runtime/lua/vim/_core/defaults.lua b/runtime/lua/vim/_core/defaults.lua index b1e705411b..720739f7c4 100644 --- a/runtime/lua/vim/_core/defaults.lua +++ b/runtime/lua/vim/_core/defaults.lua @@ -548,7 +548,7 @@ do end end - local nvim_popupmenu_augroup = vim.api.nvim_create_augroup('nvim.popupmenu', {}) + local nvim_popupmenu_augroup = vim.api.nvim_create_augroup('nvim.popupmenu') nvim_on('MenuPopup', nvim_popupmenu_augroup, { pattern = '*', desc = 'Mouse popup menu', @@ -569,7 +569,7 @@ do end) end - local nvim_terminal_augroup = vim.api.nvim_create_augroup('nvim.terminal', {}) + local nvim_terminal_augroup = vim.api.nvim_create_augroup('nvim.terminal') vim.api.nvim_create_autocmd('BufReadCmd', { pattern = 'term://*', group = nvim_terminal_augroup, @@ -615,7 +615,7 @@ do local buf = vim.bo[ev.buf] local pos = ev.data.pos ---@type integer local buf_has_exitmsg = #( - vim.api.nvim_buf_get_extmarks(ev.buf, nvim_terminal_exitmsg_ns, 0, -1, {}) + vim.api.nvim_buf_get_extmarks(ev.buf, nvim_terminal_exitmsg_ns, 0, -1) ) > 0 -- `nvim_open_term` buffers do not have an attached 'channel'. @@ -749,11 +749,11 @@ do vim.api.nvim_create_autocmd('CmdwinEnter', { pattern = '[:>]', desc = 'Limit syntax sync to maxlines=1 in the command window', - group = vim.api.nvim_create_augroup('nvim.cmdwin', {}), + group = vim.api.nvim_create_augroup('nvim.cmdwin'), command = 'syntax sync minlines=1 maxlines=1', }) - nvim_on('SwapExists', vim.api.nvim_create_augroup('nvim.swapfile', {}), { + nvim_on('SwapExists', vim.api.nvim_create_augroup('nvim.swapfile'), { pattern = '*', desc = 'Skip the swapfile prompt when the swapfile is owned by a running Nvim process', }, function() @@ -796,7 +796,7 @@ do -- attached terminal, and a |TermResponse| is not attributable to a UI, so the -- value reflects whichever terminal answers last (decided by response speed), -- not necessarily the most recently attached one. - local group = vim.api.nvim_create_augroup('nvim.tty', {}) + local group = vim.api.nvim_create_augroup('nvim.tty') --- Set an option after startup (so that OptionSet is fired), but only if not --- already set by the user. @@ -805,7 +805,7 @@ do --- @param value any Option value --- @param force boolean? Always set the value, even if already set local function setoption(option, value, force) - if not force and vim.api.nvim_get_option_info2(option, {}).was_set then + if not force and vim.api.nvim_get_option_info2(option).was_set then -- Don't do anything if option is already set return end @@ -831,7 +831,7 @@ do --- True if 'background' was set by the user, not by our detection (sid_lua). local function bg_user_set() - local info = vim.api.nvim_get_option_info2('background', {}) + local info = vim.api.nvim_get_option_info2('background') return info.was_set and info.last_set_sid ~= sid_lua end @@ -925,7 +925,7 @@ do local function detect_background(sync, chan) -- Re-create (clear) the handler's augroup on each call so only the -- most-recently-attached TUI's handler remains. - local bg_group = vim.api.nvim_create_augroup('nvim.tty.background', {}) + local bg_group = vim.api.nvim_create_augroup('nvim.tty.background') -- Send OSC 11 query. In the startup (sync) path also send a DSR probe: if -- the DSR response comes first, the terminal most likely doesn't support the @@ -1093,7 +1093,7 @@ do detect_termguicolors(tty) -- Show progress bars in supporting terminals - nvim_on('Progress', vim.api.nvim_create_augroup('nvim.progress', {}), { + nvim_on('Progress', vim.api.nvim_create_augroup('nvim.progress'), { desc = 'Display native progress bars', }, function(ev) if ev.data.status == 'running' then @@ -1127,7 +1127,7 @@ do return nil end - nvim_on('UIEnter', vim.api.nvim_create_augroup('nvim.tty.attach', {}), {}, function() + nvim_on('UIEnter', vim.api.nvim_create_augroup('nvim.tty.attach'), {}, function() local ui = attaching_tty() if not ui then return diff --git a/runtime/lua/vim/_core/editor.lua b/runtime/lua/vim/_core/editor.lua index 8a46c0537e..3dfe2a192c 100644 --- a/runtime/lua/vim/_core/editor.lua +++ b/runtime/lua/vim/_core/editor.lua @@ -485,9 +485,9 @@ local VIM_CMD_ARG_MAX = 20 vim.cmd = setmetatable({}, { __call = function(_, cmd) if type(cmd) == 'table' then - return vim.api.nvim_cmd(cmd, {}) + return vim.api.nvim_cmd(cmd) else - vim.api.nvim_exec2(cmd, {}) + vim.api.nvim_exec2(cmd) return '' end end, @@ -515,7 +515,7 @@ vim.cmd = setmetatable({}, { opts = { args = { ... } } end opts.cmd = cmd - return vim.api.nvim_cmd(opts, {}) + return vim.api.nvim_cmd(opts) end return t[cmd] end, diff --git a/runtime/lua/vim/_core/ex_cmd.lua b/runtime/lua/vim/_core/ex_cmd.lua index 9bba7aa0f8..e626b256a9 100644 --- a/runtime/lua/vim/_core/ex_cmd.lua +++ b/runtime/lua/vim/_core/ex_cmd.lua @@ -266,7 +266,7 @@ function M.ex_uptime() local now = assert(uv.clock_gettime('realtime')) local uptime = math.floor((now.sec * 1e9 + now.nsec - vim.v.starttime) / 1e9) local uptime_display = time.fmt_rtime(uptime) - api.nvim_echo({ { N_('Up %s'):format(uptime_display) } }, true, {}) + api.nvim_echo({ { N_('Up %s'):format(uptime_display) } }, true) end --- `:oldfiles` and `:browse oldfiles`. Lists v:oldfiles (plain `:oldfiles`) or shows (async) @@ -275,7 +275,7 @@ end function M.ex_oldfiles(eap) local files = vim.v.oldfiles if not files or #files == 0 then - api.nvim_echo({ { N_('No old files') } }, false, {}) + api.nvim_echo({ { N_('No old files') } }, false) return end @@ -305,7 +305,7 @@ function M.ex_oldfiles(eap) if #lines == 0 then return end - api.nvim_echo(lines, false, {}) + api.nvim_echo(lines, false) end --- Verify that all plugins in a list are installed. @@ -390,7 +390,7 @@ end --- @param line string content of the current command line --- @return string[] completions function M.packdel_complete(pattern, line) - local cmd = api.nvim_parse_cmd(line, {}) + local cmd = api.nvim_parse_cmd(line) if #cmd.args == 1 and vim.startswith(pattern, '++') then return { '++all' } end diff --git a/runtime/lua/vim/_core/exrc.lua b/runtime/lua/vim/_core/exrc.lua index 671ee948de..5af1319335 100644 --- a/runtime/lua/vim/_core/exrc.lua +++ b/runtime/lua/vim/_core/exrc.lua @@ -11,7 +11,7 @@ for _, file in ipairs(files) do if vim.endswith(file, '.lua') then assert(loadstring(trusted, '@' .. file))() else - vim.api.nvim_exec2(trusted, {}) + vim.api.nvim_exec2(trusted) end end -- If the user unset 'exrc' in the current exrc then stop searching diff --git a/runtime/lua/vim/_core/options.lua b/runtime/lua/vim/_core/options.lua index 4ccc5081e1..e814841344 100644 --- a/runtime/lua/vim/_core/options.lua +++ b/runtime/lua/vim/_core/options.lua @@ -129,7 +129,7 @@ end --- @param name string --- @return vim._option.Info local function get_options_info(name) - local info = api.nvim_get_option_info2(name, {}) + local info = api.nvim_get_option_info2(name) --- @cast info vim._option.Info info.metatype = get_option_metatype(name, info) return info @@ -247,10 +247,10 @@ end --- ``` vim.o = setmetatable({}, { __index = function(_, k) - return api.nvim_get_option_value(k, {}) + return api.nvim_get_option_value(k) end, __newindex = function(_, k, v) - api.nvim_set_option_value(k, v, {}) + api.nvim_set_option_value(k, v) end, }) diff --git a/runtime/lua/vim/_core/shared.lua b/runtime/lua/vim/_core/shared.lua index 54fda47214..0c7500dea4 100644 --- a/runtime/lua/vim/_core/shared.lua +++ b/runtime/lua/vim/_core/shared.lua @@ -1515,7 +1515,7 @@ local get_context_state = function(context) for name, _ in pairs(context[scope] or {} --[[@as table<string,any>]]) do - local sc = scope == 'o' and scope_map[vim.api.nvim_get_option_info2(name, {}).scope] or scope + local sc = scope == 'o' and scope_map[vim.api.nvim_get_option_info2(name).scope] or scope -- Do not override already set state and fall back to `vim.NIL` for -- state `nil` values (which still needs restoring later) diff --git a/runtime/lua/vim/_core/swapfile.lua b/runtime/lua/vim/_core/swapfile.lua index 12f9b56a50..098046d786 100644 --- a/runtime/lua/vim/_core/swapfile.lua +++ b/runtime/lua/vim/_core/swapfile.lua @@ -80,7 +80,7 @@ function M.list_swaps(items) lines[#lines + 1] = { ('%d. %s\n'):format(i, format_swap(path)) } end end - api.nvim_echo(lines, false, {}) + api.nvim_echo(lines, false) end return M diff --git a/runtime/lua/vim/_core/ui2.lua b/runtime/lua/vim/_core/ui2.lua index 619abde1c4..deadf5fa10 100644 --- a/runtime/lua/vim/_core/ui2.lua +++ b/runtime/lua/vim/_core/ui2.lua @@ -52,7 +52,7 @@ local api = vim.api local nvim_on = require('vim._core.util').nvim_on local M = { ns = api.nvim_create_namespace('nvim.ui2'), - augroup = api.nvim_create_augroup('nvim.ui2', {}), + augroup = api.nvim_create_augroup('nvim.ui2'), cmdheight = vim.o.cmdheight, -- 'cmdheight' option value set by user. redrawing = false, -- True when redrawing to display UI event. wins = { cmd = -1, dialog = -1, msg = -1, pager = -1 }, @@ -147,7 +147,7 @@ function M.check_targets() if type == 'pager' then -- Close pager with `q`, same as `checkhealth` - api.nvim_buf_set_keymap(M.bufs.pager, 'n', 'q', '<Cmd>wincmd c<CR>', {}) + api.nvim_buf_set_keymap(M.bufs.pager, 'n', 'q', '<Cmd>wincmd c<CR>') elseif M.msg[type] then M.msg[type].prev_msg = '' -- Will no longer be visible. end diff --git a/runtime/lua/vim/_core/ui2/cmdline.lua b/runtime/lua/vim/_core/ui2/cmdline.lua index ec06550455..62cb07717c 100644 --- a/runtime/lua/vim/_core/ui2/cmdline.lua +++ b/runtime/lua/vim/_core/ui2/cmdline.lua @@ -22,7 +22,7 @@ local function win_config(win, hide, height) if ui.cmdheight == 0 and api.nvim_win_get_config(win).hide ~= hide then api.nvim_win_set_config(win, { hide = hide, height = not hide and height or nil }) elseif api.nvim_win_get_height(win) ~= height then - api.nvim_win_resize(win, -1, height, {}) + api.nvim_win_resize(win, -1, height) end if vim.o.cmdheight ~= height then -- Avoid moving the cursor with 'splitkeep' = "screen", and altering the user @@ -105,7 +105,7 @@ function M.cmdline_show(content, pos, firstc, prompt, indent, level, hl_id) set_text(content, ('%s%s%s'):format(firstc, prompt, (' '):rep(indent)), hl_id) ui.msg.virt.last = { {}, {}, {}, {} } - local height = math.max(ui.cmdheight, api.nvim_win_text_height(ui.wins.cmd, {}).all) + local height = math.max(ui.cmdheight, api.nvim_win_text_height(ui.wins.cmd).all) win_config(ui.wins.cmd, false, height) M.cmdline_pos(pos) end diff --git a/runtime/lua/vim/_core/ui2/messages.lua b/runtime/lua/vim/_core/ui2/messages.lua index 07dc9c205a..aa3888635b 100644 --- a/runtime/lua/vim/_core/ui2/messages.lua +++ b/runtime/lua/vim/_core/ui2/messages.lua @@ -139,7 +139,7 @@ local function set_virttext(type, tgt) -- Check if adding the virt_text on this line will exceed the current window width. local maxwidth = math.max(M.msg.width, math.min(o.columns, scol - offset + width)) if tgt == 'msg' and api.nvim_win_get_width(win) < maxwidth then - api.nvim_win_resize(win, maxwidth, -1, {}) + api.nvim_win_resize(win, maxwidth, -1) M.msg.width = maxwidth end @@ -293,7 +293,7 @@ function M.show_msg(tgt, kind, content, replace_last, append, id) if tgt == 'msg' then local width_cmd = [[echo max(map(range(1, line('$')), 'virtcol([v:val, "$"])'))]] local width = tonumber(fn.win_execute(ui.wins.msg, width_cmd)) - 1 - api.nvim_win_resize(ui.wins.msg, width, -1, {}) + api.nvim_win_resize(ui.wins.msg, width, -1) local texth = api.nvim_win_text_height(ui.wins.msg, { start_row = start_row, end_row = row }) if texth.all > math.ceil(lines * 0.5) then tgt, buf = M.expand_msg(tgt) diff --git a/runtime/lua/vim/_core/util.lua b/runtime/lua/vim/_core/util.lua index 0f56256558..7bf4f53de7 100644 --- a/runtime/lua/vim/_core/util.lua +++ b/runtime/lua/vim/_core/util.lua @@ -66,7 +66,7 @@ end function M.wrapped_edit(file, mods) assert(mods) if type(mods) == 'string' then - mods = vim.api.nvim_parse_cmd(mods .. ' edit', {}).mods --[[@as vim.api.keyset.cmd_mods]] + mods = vim.api.nvim_parse_cmd(mods .. ' edit').mods --[[@as vim.api.keyset.cmd_mods]] end --- @cast mods vim.api.keyset.cmd_mods if (mods.tab or 0) > 0 or (mods.split or '') ~= '' or mods.horizontal or mods.vertical then diff --git a/runtime/lua/vim/_meta/api.gen.lua b/runtime/lua/vim/_meta/api.gen.lua index 5b207281d4..d5208ce596 100644 --- a/runtime/lua/vim/_meta/api.gen.lua +++ b/runtime/lua/vim/_meta/api.gen.lua @@ -38,7 +38,7 @@ function vim.api.nvim__cmdwin_set(type, buf) end --- returns the window and buffer ids, or empty dict if not shown. --- --- @param index integer Completion candidate index ---- @param opts vim.api.keyset.complete_set Optional parameters. +--- @param opts vim.api.keyset.complete_set? Optional parameters. --- - info: (string) info text. --- @return table<string,number> # Dict containing these keys: --- - winid: (number) floating window id @@ -56,7 +56,7 @@ function vim.api.nvim__get_lib_dir() end --- --- @param pat string[] pattern of files to search for --- @param all boolean whether to return all matches or only the first ---- @param opts vim.api.keyset.runtime is_lua: only search Lua subdirs +--- @param opts vim.api.keyset.runtime? is_lua: only search Lua subdirs --- @return string[] # list of absolute paths to the found files function vim.api.nvim__get_runtime(pat, all, opts) end @@ -132,7 +132,7 @@ function vim.api.nvim__ns_get(ns_id) end --- Set some properties for namespace --- --- @param ns_id integer Namespace ---- @param opts vim.api.keyset.ns_opts Optional parameters to set: +--- @param opts vim.api.keyset.ns_opts? Optional parameters to set: --- - wins: a list of windows to be scoped in function vim.api.nvim__ns_set(ns_id, opts) end @@ -142,7 +142,7 @@ function vim.api.nvim__ns_set(ns_id, opts) end --- --- --- @see `:help :redraw` ---- @param opts vim.api.keyset.redraw Optional parameters. +--- @param opts vim.api.keyset.redraw? Optional parameters. --- - buf: Target a specific buffer number as described below. --- - cursor: Immediately update cursor position on the screen in --- `win` or the current window. @@ -224,7 +224,7 @@ function vim.api.nvim_buf_add_highlight(buffer, ns_id, hl_group, line, col_start --- whole buffer: first notification will be `nvim_buf_lines_event`. --- Else the first notification will be `nvim_buf_changedtick_event`. --- Not for Lua callbacks. ---- @param opts vim.api.keyset.buf_attach Optional parameters. +--- @param opts vim.api.keyset.buf_attach? Optional parameters. --- - on_bytes: Called on granular changes (compared to on_lines). Not called on buffer --- reload (`:checktime`, `:edit`, …), see `on_reload:`. Return a [lua-truthy] value --- to detach. Args: @@ -317,7 +317,7 @@ function vim.api.nvim_buf_clear_namespace(buf, ns_id, line_start, line_end) end --- @param buf integer Buffer id, or 0 for current buffer. --- @param name string --- @param cmd any ---- @param opts vim.api.keyset.user_command +--- @param opts vim.api.keyset.user_command? function vim.api.nvim_buf_create_user_command(buf, name, cmd, opts) end --- Removes an `extmark`. @@ -374,7 +374,7 @@ function vim.api.nvim_buf_del_var(buf, name) end --- ``` --- --- @param buf integer Buffer id, or 0 for current buffer ---- @param opts vim.api.keyset.buf_delete Optional parameters. Keys: +--- @param opts vim.api.keyset.buf_delete? Optional parameters. Keys: --- - force: Force deletion, ignore unsaved changes. --- - unload: Unloaded only (`:bunload`), do not delete. function vim.api.nvim_buf_delete(buf, opts) end @@ -388,7 +388,7 @@ function vim.api.nvim_buf_get_changedtick(buf) end --- Gets a map of buffer-local `user-commands`. --- --- @param buf integer Buffer id, or 0 for current buffer ---- @param opts vim.api.keyset.get_commands Optional parameters. Currently not used. +--- @param opts vim.api.keyset.get_commands? Optional parameters. Currently not used. --- @return vim.api.keyset.command_info # Map of maps describing commands. function vim.api.nvim_buf_get_commands(buf, opts) end @@ -397,7 +397,7 @@ function vim.api.nvim_buf_get_commands(buf, opts) end --- @param buf integer Buffer id, or 0 for current buffer --- @param ns_id integer Namespace id from `nvim_create_namespace()` --- @param id integer Extmark id ---- @param opts vim.api.keyset.get_extmark Optional parameters. Keys: +--- @param opts vim.api.keyset.get_extmark? Optional parameters. Keys: --- - details: Whether to include the details dict --- - hl_name: Whether to include highlight group name instead of id, true if omitted --- @return [integer, integer, vim.api.keyset.extmark_details?] # 0-indexed (row, col, details?) tuple or empty list () if extmark id was absent. The @@ -417,8 +417,8 @@ function vim.api.nvim_buf_get_extmark_by_id(buf, ns_id, id, opts) end --- respectively, thus the following are equivalent: --- --- ```lua ---- vim.api.nvim_buf_get_extmarks(0, my_ns, 0, -1, {}) ---- vim.api.nvim_buf_get_extmarks(0, my_ns, {0,0}, {-1,-1}, {}) +--- vim.api.nvim_buf_get_extmarks(0, my_ns, 0, -1) +--- vim.api.nvim_buf_get_extmarks(0, my_ns, {0,0}, {-1,-1}) --- ``` --- --- If `end` is less than `start`, marks are returned in reverse order. @@ -442,13 +442,13 @@ function vim.api.nvim_buf_get_extmark_by_id(buf, ns_id, id, opts) end --- local pos = api.nvim_win_get_cursor(0) --- local ns = api.nvim_create_namespace('my-plugin') --- -- Create new extmark at line 1, column 1. ---- local m1 = api.nvim_buf_set_extmark(0, ns, 0, 0, {}) +--- local m1 = api.nvim_buf_set_extmark(0, ns, 0, 0) --- -- Create new extmark at line 3, column 1. ---- local m2 = api.nvim_buf_set_extmark(0, ns, 2, 0, {}) +--- local m2 = api.nvim_buf_set_extmark(0, ns, 2, 0) --- -- Get extmarks only from line 3. ---- local ms = api.nvim_buf_get_extmarks(0, ns, {2,0}, {2,0}, {}) +--- local ms = api.nvim_buf_get_extmarks(0, ns, {2,0}, {2,0}) --- -- Get all marks in this buffer + namespace. ---- local all = api.nvim_buf_get_extmarks(0, ns, 0, -1, {}) +--- local all = api.nvim_buf_get_extmarks(0, ns, 0, -1) --- vim.print(ms) --- ``` --- @@ -458,7 +458,7 @@ function vim.api.nvim_buf_get_extmark_by_id(buf, ns_id, id, opts) end --- (whose position defines the bound). `api-indexing` --- @param end_ any End of range (inclusive): a 0-indexed (row, col) or valid --- extmark id (whose position defines the bound). `api-indexing` ---- @param opts vim.api.keyset.get_extmarks Optional parameters. Keys: +--- @param opts vim.api.keyset.get_extmarks? Optional parameters. Keys: --- - details: Whether to include the details dict --- - hl_name: Whether to include highlight group name instead of id, true if omitted --- - limit: Maximum number of marks to return @@ -556,7 +556,7 @@ function vim.api.nvim_buf_get_option(buffer, name) end --- @param start_col integer Starting column (byte offset) on first line --- @param end_row integer Last line index, inclusive --- @param end_col integer Ending column (byte offset) on last line, exclusive ---- @param opts vim.api.keyset.empty Optional parameters. Currently unused. +--- @param opts vim.api.keyset.empty? Optional parameters. Currently unused. --- @return string[] # Array of lines, or empty array for unloaded buffer. function vim.api.nvim_buf_get_text(buf, start_row, start_col, end_row, end_col, opts) end @@ -611,7 +611,7 @@ function vim.api.nvim_buf_line_count(buf) end --- @param ns_id integer Namespace id from `nvim_create_namespace()` --- @param line integer Line where to place the mark, 0-based. `api-indexing` --- @param col integer Column where to place the mark, 0-based. `api-indexing` ---- @param opts vim.api.keyset.set_extmark Optional parameters: +--- @param opts vim.api.keyset.set_extmark? Optional parameters: --- - conceal: (boolean|string) --- - string: Single char or empty string, enables conceal similar to `:syn-conceal`. --- Non-empty char is used as `:syn-cchar`. Highlighted with "hl_group" if @@ -711,7 +711,7 @@ function vim.api.nvim_buf_set_extmark(buf, ns_id, line, col, opts) end --- @param mode string --- @param lhs string --- @param rhs string ---- @param opts vim.api.keyset.keymap +--- @param opts vim.api.keyset.keymap? function vim.api.nvim_buf_set_keymap(buf, mode, lhs, rhs, opts) end --- Sets (replaces) a line-range in the buffer. @@ -750,7 +750,7 @@ function vim.api.nvim_buf_set_lines(buf, start, end_, strict_indexing, replaceme --- @param name string Mark name --- @param line integer Line number --- @param col integer Column/row number ---- @param opts vim.api.keyset.empty Optional parameters. Reserved for future use. +--- @param opts vim.api.keyset.empty? Optional parameters. Reserved for future use. --- @return boolean # true if the mark was set, else false. function vim.api.nvim_buf_set_mark(buf, name, line, col, opts) end @@ -804,7 +804,7 @@ function vim.api.nvim_buf_set_var(buf, name, value) end --- @param src_id integer --- @param line integer --- @param chunks any[] ---- @param opts vim.api.keyset.empty +--- @param opts vim.api.keyset.empty? --- @return integer function vim.api.nvim_buf_set_virtual_text(buffer, src_id, line, chunks, opts) end @@ -843,7 +843,7 @@ function vim.api.nvim_chan_send(chan, data) end --- Clears all autocommands matching the {opts} query. To delete autocmds see `nvim_del_autocmd()`. --- ---- @param opts vim.api.keyset.clear_autocmds Optional parameters: +--- @param opts vim.api.keyset.clear_autocmds? Optional parameters: --- - buf: (`integer?`) Select `autocmd-buflocal` autocommands. Not allowed with {pattern}. --- - event: (`vim.api.keyset.events|vim.api.keyset.events[]?`) --- Examples: @@ -883,7 +883,7 @@ function vim.api.nvim_clear_autocmds(opts) end --- @param cmd vim.api.keyset.cmd Command to execute, a Dict with the same structure as the return value of --- `nvim_parse_cmd()` (except "addr", "nargs" and "nextcmd" are ignored). --- All keys except "cmd" are optional. ---- @param opts vim.api.keyset.cmd_opts Optional parameters. +--- @param opts vim.api.keyset.cmd_opts? Optional parameters. --- - output: (boolean, default false) Whether to return command output. --- @return string # Command output (non-error, non-shell |:!|) if `output` is true, else empty string. function vim.api.nvim_cmd(cmd, opts) end @@ -916,7 +916,7 @@ function vim.api.nvim_command_output(command) end --- --- @see `:help autocmd-groups` --- @param name string Group name ---- @param opts vim.api.keyset.create_augroup Optional parameters: +--- @param opts vim.api.keyset.create_augroup? Optional parameters: --- - clear (`boolean?`, default: true) Clear existing commands in the group `autocmd-groups`. --- @return integer # Group id. function vim.api.nvim_create_augroup(name, opts) end @@ -954,7 +954,7 @@ function vim.api.nvim_create_augroup(name, opts) end --- @see `:help autocommand` --- @see vim.api.nvim_del_autocmd --- @param event vim.api.keyset.events|vim.api.keyset.events[] Event(s) that will trigger the handler (`callback` or `command`). ---- @param opts vim.api.keyset.create_autocmd Options dict: +--- @param opts vim.api.keyset.create_autocmd? Options dict: --- - buf (`integer?`) Buffer id for buffer-local autocommands `autocmd-buflocal`. --- Not allowed with {pattern}. --- - callback (`function|string?`) Lua function (or Vimscript function name, if string) @@ -1025,7 +1025,7 @@ function vim.api.nvim_create_namespace(name) end --- - range: (number) Number of items in the command range: 0, 1, or 2. [<range>] --- - reg: (string) Register name, if any. [<reg>] --- - smods: (table) Command modifiers (structured), same as "mods" in `nvim_parse_cmd()`. ---- @param opts vim.api.keyset.user_command Optional flags: +--- @param opts vim.api.keyset.user_command? Optional flags: --- - `addr` `:command-addr` --- - `complete` `:command-complete` command or function `:command-completion-customlist`. --- - `count` `:command-count` @@ -1106,13 +1106,13 @@ function vim.api.nvim_del_var(name) end --- --- Example: --- ```lua ---- vim.api.nvim_echo({ { 'chunk1-line1\nchunk1-line2\n' }, { 'chunk2-line1' } }, true, {}) +--- vim.api.nvim_echo({ { 'chunk1-line1\nchunk1-line2\n' }, { 'chunk2-line1' } }, true) --- ``` --- --- @param chunks [string, integer|string?][] List of `[text, hl_group]` pairs, where each is a `text` string highlighted by --- the (optional) name or ID `hl_group`. --- @param history boolean if true, add to `message-history`. ---- @param opts vim.api.keyset.echo_opts Optional parameters. +--- @param opts vim.api.keyset.echo_opts? Optional parameters. --- - data (`table?`) Dict of arbitrary data, available in `Progress` `event-data`. --- - err (`boolean?`) Treat the message like `:echoerr`. Sets `hl_group` to `hl-ErrorMsg` by default. --- - id (`integer|string?`) Message-id returned by a previous `nvim_echo` call, or @@ -1153,7 +1153,7 @@ function vim.api.nvim_eval(expr) end --- Evaluates statusline string. --- --- @param str string Statusline string (see 'statusline'). ---- @param opts vim.api.keyset.eval_statusline Optional parameters. +--- @param opts vim.api.keyset.eval_statusline? Optional parameters. --- - fillchar: (string) Character to fill blank spaces in the statusline (see --- 'fillchars'). Treated as single-width even if it isn't. --- - highlights: (boolean) Return highlight information. @@ -1194,7 +1194,7 @@ function vim.api.nvim_exec(src, output) end --- @see vim.api.nvim_command --- @see vim.api.nvim_cmd --- @param src string Vimscript code ---- @param opts vim.api.keyset.exec_opts Optional parameters. +--- @param opts vim.api.keyset.exec_opts? Optional parameters. --- - output: (boolean, default false) Whether to capture and return --- all (non-error, non-shell `:!`) output. --- @return table<string,any> # Dict containing information about execution, with these keys: @@ -1205,7 +1205,7 @@ function vim.api.nvim_exec2(src, opts) end --- --- @see `:help :doautocmd` --- @param event vim.api.keyset.events|vim.api.keyset.events[] Event(s) to execute. ---- @param opts vim.api.keyset.exec_autocmds Optional filters: +--- @param opts vim.api.keyset.exec_autocmds? Optional filters: --- - buf (`integer?`) Buffer where the event is applied. `autocmd-buflocal` Not allowed with {pattern}. --- - data (`any`): Arbitrary data passed to the callback. See `nvim_create_autocmd()`. --- - group (`string|integer?`) Group name or id to match against. `autocmd-groups`. @@ -1270,7 +1270,7 @@ function vim.api.nvim_get_all_options_info() end --- }) --- ``` --- ---- @param opts vim.api.keyset.get_autocmds Dict with at least one of these keys: +--- @param opts vim.api.keyset.get_autocmds? Dict with at least one of these keys: --- - buf: (`integer[]|integer?`) Buffer id or list of buffer ids, for buffer-local autocommands --- `autocmd-buflocal`. Not allowed with {pattern}. --- - event: (`vim.api.keyset.events|vim |