From 9982f6e0e4f712aea28d3351f180786d29cf808d Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 13 Jul 2026 19:25:39 +0200 Subject: refactor(api): omit optional param --- runtime/lua/vim/_comment.lua | 2 +- runtime/lua/vim/_core/defaults.lua | 22 +++++++++++----------- runtime/lua/vim/_core/editor.lua | 6 +++--- runtime/lua/vim/_core/ex_cmd.lua | 8 ++++---- runtime/lua/vim/_core/exrc.lua | 2 +- runtime/lua/vim/_core/options.lua | 6 +++--- runtime/lua/vim/_core/shared.lua | 2 +- runtime/lua/vim/_core/swapfile.lua | 2 +- runtime/lua/vim/_core/ui2.lua | 4 ++-- runtime/lua/vim/_core/ui2/cmdline.lua | 4 ++-- runtime/lua/vim/_core/ui2/messages.lua | 4 ++-- runtime/lua/vim/_core/util.lua | 2 +- runtime/lua/vim/_meta/api.gen.lua | 16 ++++++++-------- runtime/lua/vim/diagnostic.lua | 2 +- runtime/lua/vim/diagnostic/_jump.lua | 2 +- runtime/lua/vim/diagnostic/_store.lua | 2 +- runtime/lua/vim/loader.lua | 2 +- runtime/lua/vim/lsp.lua | 2 +- runtime/lua/vim/lsp/completion.lua | 4 ++-- runtime/lua/vim/lsp/linked_editing_range.lua | 2 +- runtime/lua/vim/lsp/on_type_formatting.lua | 2 +- runtime/lua/vim/lsp/util.lua | 6 +++--- runtime/lua/vim/provider/perl.lua | 2 +- runtime/lua/vim/provider/python.lua | 2 +- runtime/lua/vim/provider/ruby.lua | 2 +- runtime/lua/vim/snippet.lua | 4 ++-- runtime/lua/vim/treesitter.lua | 2 +- runtime/lua/vim/treesitter/_fold.lua | 2 +- runtime/lua/vim/treesitter/dev.lua | 6 +++--- runtime/lua/vim/treesitter/highlighter.lua | 2 +- runtime/lua/vim/ui/clipboard/osc52.lua | 2 +- 31 files changed, 64 insertions(+), 64 deletions(-) (limited to 'runtime/lua/vim') 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]]) 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', 'wincmd c', {}) + api.nvim_buf_set_keymap(M.bufs.pager, 'n', 'q', 'wincmd c') 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..ac8121af5e 100644 --- a/runtime/lua/vim/_meta/api.gen.lua +++ b/runtime/lua/vim/_meta/api.gen.lua @@ -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) --- ``` --- @@ -1106,7 +1106,7 @@ 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 @@ -1707,7 +1707,7 @@ function vim.api.nvim_open_tabpage(buf, enter, config) end --- --- ```lua --- vim.api.nvim_create_user_command('TermHl', function() ---- vim.api.nvim_open_term(0, {}) +--- vim.api.nvim_open_term(0) --- end, { desc = 'Highlights ANSI termcodes in curbuf' }) --- ``` --- diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua index 66110d938f..fc800cf8b2 100644 --- a/runtime/lua/vim/diagnostic.lua +++ b/runtime/lua/vim/diagnostic.lua @@ -1145,7 +1145,7 @@ function M.status(buf) return result_str end -nvim_on('DiagnosticChanged', api.nvim_create_augroup('nvim.diagnostic.status', {}), { +nvim_on('DiagnosticChanged', api.nvim_create_augroup('nvim.diagnostic.status'), { desc = 'diagnostics component for the statusline', }, function(ev) if vim.fn.win_gettype(vim.fn.bufwinid(ev.buf)) == '' then diff --git a/runtime/lua/vim/diagnostic/_jump.lua b/runtime/lua/vim/diagnostic/_jump.lua index 15f3c528c4..f1f91163be 100644 --- a/runtime/lua/vim/diagnostic/_jump.lua +++ b/runtime/lua/vim/diagnostic/_jump.lua @@ -123,7 +123,7 @@ end --- @param opts vim.diagnostic.JumpOpts? local function goto_diagnostic(diagnostic, opts) if not diagnostic then - api.nvim_echo({ { 'No more valid diagnostics to move to', 'WarningMsg' } }, true, {}) + api.nvim_echo({ { 'No more valid diagnostics to move to', 'WarningMsg' } }, true) return end diff --git a/runtime/lua/vim/diagnostic/_store.lua b/runtime/lua/vim/diagnostic/_store.lua index aef06dc8d9..336929f21b 100644 --- a/runtime/lua/vim/diagnostic/_store.lua +++ b/runtime/lua/vim/diagnostic/_store.lua @@ -9,7 +9,7 @@ local M = {} -- bufnr -> ns -> Diagnostic[] local diagnostic_cache = {} --- @type table> -local group = api.nvim_create_augroup('nvim.diagnostic.buf_wipeout', {}) +local group = api.nvim_create_augroup('nvim.diagnostic.buf_wipeout') setmetatable(diagnostic_cache, { --- @param t table --- @param bufnr integer diff --git a/runtime/lua/vim/loader.lua b/runtime/lua/vim/loader.lua index 4880795116..7d177fd11c 100644 --- a/runtime/lua/vim/loader.lua +++ b/runtime/lua/vim/loader.lua @@ -527,7 +527,7 @@ function M._inspect(opts) end end end - vim.api.nvim_echo(chunks, true, {}) + vim.api.nvim_echo(chunks, true) end return stats end diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index c60c85eeda..6abf6a5199 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -644,7 +644,7 @@ function lsp.enable(name, enable) else -- Only ever create autocmd once to reuse computation of config merging. lsp_enable_autocmd_id = lsp_enable_autocmd_id - or nvim_on('FileType', api.nvim_create_augroup('nvim.lsp.enable', {}), function(ev) + or nvim_on('FileType', api.nvim_create_augroup('nvim.lsp.enable'), function(ev) lsp_enable_callback(ev.buf) end) end diff --git a/runtime/lua/vim/lsp/completion.lua b/runtime/lua/vim/lsp/completion.lua index ad258e4363..f34031cc7c 100644 --- a/runtime/lua/vim/lsp/completion.lua +++ b/runtime/lua/vim/lsp/completion.lua @@ -676,8 +676,8 @@ local function update_popup_window(winid, bufnr, kind) vim.wo[winid].conceallevel = 2 vim.treesitter.start(bufnr, kind) end - local all = api.nvim_win_text_height(winid, {}).all - api.nvim_win_resize(winid, -1, all, {}) + local all = api.nvim_win_text_height(winid).all + api.nvim_win_resize(winid, -1, all) end end diff --git a/runtime/lua/vim/lsp/linked_editing_range.lua b/runtime/lua/vim/lsp/linked_editing_range.lua index 10aace6096..96d5c96646 100644 --- a/runtime/lua/vim/lsp/linked_editing_range.lua +++ b/runtime/lua/vim/lsp/linked_editing_range.lua @@ -60,7 +60,7 @@ local function update_ranges(bufnr, client_state) end local r = assert(ranges[client_state.range_index]) - local replacement = api.nvim_buf_get_text(bufnr, r[2], r[3], r[4].end_row, r[4].end_col, {}) + local replacement = api.nvim_buf_get_text(bufnr, r[2], r[3], r[4].end_row, r[4].end_col) if not string.match(table.concat(replacement, '\n'), client_state.word_pattern) then clear_ranges(bufnr, client_state) diff --git a/runtime/lua/vim/lsp/on_type_formatting.lua b/runtime/lua/vim/lsp/on_type_formatting.lua index 6ad70bfdab..67c6d012af 100644 --- a/runtime/lua/vim/lsp/on_type_formatting.lua +++ b/runtime/lua/vim/lsp/on_type_formatting.lua @@ -9,7 +9,7 @@ local current_buf = api.nvim_get_current_buf local get_mode = api.nvim_get_mode local ns = api.nvim_create_namespace('nvim.lsp.on_type_formatting') -local augroup = api.nvim_create_augroup('nvim.lsp.on_type_formatting', {}) +local augroup = api.nvim_create_augroup('nvim.lsp.on_type_formatting') local M = {} diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index 6dd4c6f0bb..44a6880727 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -327,7 +327,7 @@ function M.apply_text_edits(text_edits, bufnr, position_encoding, change_annotat -- make sure we don't go out of bounds pos[1] = math.min(pos[1], max) pos[2] = math.min(pos[2], #get_line(bufnr, pos[1] - 1)) - api.nvim_buf_set_mark(bufnr or 0, mark, pos[1], pos[2], {}) + api.nvim_buf_set_mark(bufnr or 0, mark, pos[1], pos[2]) end end @@ -473,7 +473,7 @@ function M.rename(old_fname, new_fname, opts) return end -- no need to preserve if such a buffer is empty - api.nvim_buf_delete(existing_buf, {}) + api.nvim_buf_delete(existing_buf) end buf_rename[b] = { from = old_bname, to = new_bname } @@ -1625,7 +1625,7 @@ function M.open_floating_preview(contents, syntax, opts) local win_height = api.nvim_win_get_height(floating_winnr) local text_height = api.nvim_win_text_height(floating_winnr, { max_height = win_height }).all if text_height < win_height then - api.nvim_win_resize(floating_winnr, -1, text_height, {}) + api.nvim_win_resize(floating_winnr, -1, text_height) end end end diff --git a/runtime/lua/vim/provider/perl.lua b/runtime/lua/vim/provider/perl.lua index 5118f11b0b..85ab00a57d 100644 --- a/runtime/lua/vim/provider/perl.lua +++ b/runtime/lua/vim/provider/perl.lua @@ -46,7 +46,7 @@ function M.call(method, args) local ok, result = pcall(vim.fn['remote#host#Require'], 'legacy-perl-provider') ---@type any, any if not ok then s_err = result - vim.api.nvim_echo({ { result, 'WarningMsg' } }, true, {}) + vim.api.nvim_echo({ { result, 'WarningMsg' } }, true) return end s_host = result diff --git a/runtime/lua/vim/provider/python.lua b/runtime/lua/vim/provider/python.lua index 9950a731f1..34b7b64a9f 100644 --- a/runtime/lua/vim/provider/python.lua +++ b/runtime/lua/vim/provider/python.lua @@ -136,7 +136,7 @@ function M.call(method, args) local ok, result = pcall(vim.fn['remote#host#Require'], 'legacy-python3-provider') ---@type any, any if not ok then s_err = result - vim.api.nvim_echo({ { result, 'WarningMsg' } }, true, {}) + vim.api.nvim_echo({ { result, 'WarningMsg' } }, true) return end s_host = result diff --git a/runtime/lua/vim/provider/ruby.lua b/runtime/lua/vim/provider/ruby.lua index 299db64b44..52dd718968 100644 --- a/runtime/lua/vim/provider/ruby.lua +++ b/runtime/lua/vim/provider/ruby.lua @@ -24,7 +24,7 @@ function M.call(method, args) local ok, result = pcall(vim.fn['remote#host#Require'], 'legacy-ruby-provider') ---@type any, any if not ok then s_err = result - vim.api.nvim_echo({ { result, 'WarningMsg' } }, true, {}) + vim.api.nvim_echo({ { result, 'WarningMsg' } }, true) return end s_host = result diff --git a/runtime/lua/vim/snippet.lua b/runtime/lua/vim/snippet.lua index d42e16c44b..96b5e76ddd 100644 --- a/runtime/lua/vim/snippet.lua +++ b/runtime/lua/vim/snippet.lua @@ -11,7 +11,7 @@ --- Heads-up: |vim.snippet.jump()| re-registers them on every jump. local G = vim.lsp._snippet_grammar -local snippet_group = vim.api.nvim_create_augroup('nvim.snippet', {}) +local snippet_group = vim.api.nvim_create_augroup('nvim.snippet') local snippet_ns = vim.api.nvim_create_namespace('nvim.snippet') local hl_group = 'SnippetTabstop' local hl_group_active = 'SnippetTabstopActive' @@ -166,7 +166,7 @@ end function Tabstop:get_text() local range = self:get_range() return table.concat( - vim.api.nvim_buf_get_text(self.bufnr, range[1], range[2], range[3], range[4], {}), + vim.api.nvim_buf_get_text(self.bufnr, range[1], range[2], range[3], range[4]), '\n' ) end diff --git a/runtime/lua/vim/treesitter.lua b/runtime/lua/vim/treesitter.lua index 8e63750dd2..fb264ba8f9 100644 --- a/runtime/lua/vim/treesitter.lua +++ b/runtime/lua/vim/treesitter.lua @@ -213,7 +213,7 @@ local function buf_range_get_text(buf, range) end_row = end_row - 1 end - local lines = api.nvim_buf_get_text(buf, start_row, start_col, end_row, end_col, {}) + local lines = api.nvim_buf_get_text(buf, start_row, start_col, end_row, end_col) if append_newline then table.insert(lines, '') end diff --git a/runtime/lua/vim/treesitter/_fold.lua b/runtime/lua/vim/treesitter/_fold.lua index 6665f5e2dd..99739753e8 100644 --- a/runtime/lua/vim/treesitter/_fold.lua +++ b/runtime/lua/vim/treesitter/_fold.lua @@ -202,7 +202,7 @@ local M = {} ---@type table local foldinfos = {} -local group = api.nvim_create_augroup('nvim.treesitter.fold', {}) +local group = api.nvim_create_augroup('nvim.treesitter.fold') --- Update the folds in the windows that contain the buffer and use expr foldmethod (assuming that --- the user doesn't use different foldexpr for the same buffer). diff --git a/runtime/lua/vim/treesitter/dev.lua b/runtime/lua/vim/treesitter/dev.lua index 64d9a1352e..dc7a73432d 100644 --- a/runtime/lua/vim/treesitter/dev.lua +++ b/runtime/lua/vim/treesitter/dev.lua @@ -353,7 +353,7 @@ function M.inspect_tree(opts) local win = api.nvim_get_current_win() local treeview, err = TSTreeView:new(buf, opts.lang) if err and err:match('no parser for lang') then - api.nvim_echo({ { err, 'WarningMsg' } }, true, {}) + api.nvim_echo({ { err, 'WarningMsg' } }, true) return elseif not treeview then error(err) @@ -468,7 +468,7 @@ function M.inspect_tree(opts) nowait = true, }) - local group = api.nvim_create_augroup('nvim.treesitter.dev', {}) + local group = api.nvim_create_augroup('nvim.treesitter.dev') nvim_on('CursorMoved', group, { buf = b }, function() if not api.nvim_buf_is_loaded(buf) then @@ -647,7 +647,7 @@ function M.edit_query(lang) -- can infer the language later. api.nvim_buf_set_name(query_buf, string.format('%s/query_editor.scm', lang)) - local group = api.nvim_create_augroup('nvim.treesitter.dev_edit', {}) + local group = api.nvim_create_augroup('nvim.treesitter.dev_edit') nvim_on({ 'TextChanged', 'InsertLeave' }, group, { buf = query_buf, desc = 'Update query editor diagnostics when the query changes', diff --git a/runtime/lua/vim/treesitter/highlighter.lua b/runtime/lua/vim/treesitter/highlighter.lua index c12731fb3c..60f7465727 100644 --- a/runtime/lua/vim/treesitter/highlighter.lua +++ b/runtime/lua/vim/treesitter/highlighter.lua @@ -471,7 +471,7 @@ local function on_range_impl( if (metadata.conceal_lines or metadata[capture] and metadata[capture].conceal_lines) - and #api.nvim_buf_get_extmarks(buf, ns, { start_row, 0 }, { start_row, 0 }, {}) == 0 + and #api.nvim_buf_get_extmarks(buf, ns, { start_row, 0 }, { start_row, 0 }) == 0 then api.nvim_buf_set_extmark(buf, ns, start_row, 0, { end_line = end_row, diff --git a/runtime/lua/vim/ui/clipboard/osc52.lua b/runtime/lua/vim/ui/clipboard/osc52.lua index e37b0c2be8..165dd3fffc 100644 --- a/runtime/lua/vim/ui/clipboard/osc52.lua +++ b/runtime/lua/vim/ui/clipboard/osc52.lua @@ -57,7 +57,7 @@ function M.paste(reg) ) elseif res == -2 then -- Clear message area - vim.api.nvim_echo({ { '' } }, false, {}) + vim.api.nvim_echo({ { '' } }, false) end return 0 end -- cgit From fe794153ed3f267bfba13b78fde67b999fe7e600 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 13 Jul 2026 20:01:55 +0200 Subject: feat(docs): mark optional API parameters --- runtime/lua/vim/_meta/api.gen.lua | 80 +++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 40 deletions(-) (limited to 'runtime/lua/vim') diff --git a/runtime/lua/vim/_meta/api.gen.lua b/runtime/lua/vim/_meta/api.gen.lua index ac8121af5e..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 # 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 @@ -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. [] --- - reg: (string) Register name, if any. [] --- - 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` @@ -1112,7 +1112,7 @@ function vim.api.nvim_del_var(name) end --- @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 # 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.api.keyset.events[]?`) Event(s) to match `autocmd-events`. @@ -1347,14 +1347,14 @@ function vim.api.nvim_get_color_map() end --- --- --- @see vim.api.nvim_get_all_options_info ---- @param opts vim.api.keyset.get_commands Optional parameters. Currently only supports +--- @param opts vim.api.keyset.get_commands? Optional parameters. Currently only supports --- {"builtin":false} --- @return table # Map of maps describing commands. function vim.api.nvim_get_commands(opts) end --- Gets a map of the current editor state. --- ---- @param opts vim.api.keyset.context Optional parameters. +--- @param opts vim.api.keyset.context? Optional parameters. --- - types: List of `context-types` ("regs", "jumps", "bufs", --- "gvars", …) to gather, or empty for "all". --- @return table # map of global |context|. @@ -1389,7 +1389,7 @@ function vim.api.nvim_get_current_win() end --- --- @param ns_id integer Get highlight groups for namespace ns_id `nvim_get_namespaces()`. --- Use 0 to get global highlight groups `:highlight`. ---- @param opts vim.api.keyset.get_highlight Options dict: +--- @param opts vim.api.keyset.get_highlight? Options dict: --- - create: (boolean, default true) When highlight group doesn't exist create it. --- - id: (integer) Get a highlight definition by id. --- - link: (boolean, default true) Show linked group name instead of effective definition `:hi-link`. @@ -1421,7 +1421,7 @@ function vim.api.nvim_get_hl_id_by_name(name) end --- Gets the active highlight namespace. --- ---- @param opts vim.api.keyset.get_ns Optional parameters +--- @param opts vim.api.keyset.get_ns? Optional parameters --- - winid: (number) `window-ID` for retrieving a window's highlight --- namespace. A value of -1 is returned when `nvim_win_set_hl_ns()` --- has not been called for the window (or was called with a namespace @@ -1448,7 +1448,7 @@ function vim.api.nvim_get_keymap(mode) end --- @see vim.api.nvim_buf_set_mark --- @see vim.api.nvim_del_mark --- @param name string Mark name ---- @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 [integer, integer, integer, string] # 4-tuple (row, col, buffer, buffername), (0, 0, 0, '') if the mark is --- not set. function vim.api.nvim_get_mark(name, opts) end @@ -1499,7 +1499,7 @@ function vim.api.nvim_get_option_info(name) end --- explicitly specifying {scope} in the {opts} table. --- --- @param name string Option name ---- @param opts vim.api.keyset.option Optional parameters +--- @param opts vim.api.keyset.option? Optional parameters --- - buf: Buffer number. Used for getting buffer local options. --- Implies {scope} is "local". --- - scope: One of "global" or "local". Analogous to @@ -1514,7 +1514,7 @@ function vim.api.nvim_get_option_info2(name, opts) end --- buffer or window, unless "buf" or "win" is set in {opts}. --- --- @param name string Option name ---- @param opts vim.api.keyset.option Optional parameters +--- @param opts vim.api.keyset.option? Optional parameters --- - buf: Buffer number. Used for getting buffer local options. --- Implies {scope} is "local". --- - filetype: `filetype`. Used to get the default option for a @@ -1713,7 +1713,7 @@ function vim.api.nvim_open_tabpage(buf, enter, config) end --- --- @param buf integer Buffer which displays the PTY output. The initial buffer contents (if any) will be --- written to the PTY. ---- @param opts vim.api.keyset.open_term Optional parameters. +--- @param opts vim.api.keyset.open_term? Optional parameters. --- - force_crlf: (boolean, default true) Convert "\n" to "\r\n". --- - on_input: Lua callback for input sent, i e keypresses in terminal --- mode. Note: keypresses are sent raw as they would be to the pty @@ -1886,7 +1886,7 @@ function vim.api.nvim_out_write(str) end --- Doesn't check the validity of command arguments. --- --- @param str string Command line string to parse. Cannot contain "\n". ---- @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 vim.api.keyset.cmd # Dict containing command information, with these keys: --- - cmd: (string) Command name. --- - range: (array) (optional) Command range ([] []). @@ -2092,7 +2092,7 @@ function vim.api.nvim_replace_termcodes(str, from_part, do_lt, special) end --- @param insert boolean For `ins-completion`, whether the selection should be inserted in the buffer. --- Ignored for `cmdline-completion`. --- @param finish boolean Finish the completion and dismiss the popup menu. Implies {insert}. ---- @param opts vim.api.keyset.empty Optional parameters. Reserved for future use. +--- @param opts vim.api.keyset.empty? Optional parameters. Reserved for future use. function vim.api.nvim_select_popupmenu_item(item, insert, finish, opts) end --- Sets the current window's buffer to `buf`. @@ -2151,7 +2151,7 @@ function vim.api.nvim_set_current_win(win) end --- Note: Callbacks will not run for `window-hidden`, as they are not redrawn. --- --- @param ns_id integer Namespace id from `nvim_create_namespace()` ---- @param opts vim.api.keyset.set_decoration_provider Table of callbacks: +--- @param opts vim.api.keyset.set_decoration_provider? Table of callbacks: --- - on_buf: called for each buffer being redrawn (once per edit, --- before window callbacks) --- ``` @@ -2283,7 +2283,7 @@ function vim.api.nvim_set_hl_ns_fast(ns_id) end --- "ia", "ca" or "!a" for abbreviation in Insert mode, Cmdline mode, or both, respectively --- @param lhs string Left-hand-side `{lhs}` of the mapping. --- @param rhs string Right-hand-side `{rhs}` of the mapping. ---- @param opts vim.api.keyset.keymap Optional parameters map: Accepts all `:map-arguments` as keys except [], +--- @param opts vim.api.keyset.keymap? Optional parameters map: Accepts all `:map-arguments` as keys except [], --- values are booleans (default false). Also: --- - "callback" Lua function called in place of {rhs}. --- - "desc" human-readable description. @@ -2306,7 +2306,7 @@ function vim.api.nvim_set_option(name, value) end --- --- @param name string Option name --- @param value any New option value ---- @param opts vim.api.keyset.option Optional parameters +--- @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. @@ -2518,7 +2518,7 @@ function vim.api.nvim_win_is_valid(win) end --- @param win integer `window-ID`, or 0 for current window --- @param width integer New width (columns), or -1 for "no change". --- @param height integer New height (rows), or -1 for "no change". ---- @param opts vim.api.keyset.win_resize Optional parameters. +--- @param opts vim.api.keyset.win_resize? Optional parameters. --- - anchor: Edge that stays fixed while the opposite edge moves; the --- neighbor on the moving side is resized first. One of: --- - "top" (default) or "bottom" @@ -2605,7 +2605,7 @@ function vim.api.nvim_win_set_width(win, width) end --- --- @see `:help virtcol()` for text width. --- @param win integer `window-ID`, or 0 for current window. ---- @param opts vim.api.keyset.win_text_height Optional parameters: +--- @param opts vim.api.keyset.win_text_height? Optional parameters: --- - end_row: Ending line index, 0-based inclusive. --- When omitted end at the very bottom. --- - end_vcol: Ending virtual column index on "end_row", -- cgit