diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 13b4c0a6f1..658501cf14 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -508,16 +508,16 @@ Let's set an extmark at the first row (row=0) and third column (column=2). < >vim let g:mark_ns = nvim_create_namespace('myplugin') - let g:mark_id = nvim_buf_set_extmark(0, g:mark_ns, 0, 2, {}) + let g:mark_id = nvim_buf_set_extmark(0, g:mark_ns, 0, 2) < We can get the mark by its id: >vim - echo nvim_buf_get_extmark_by_id(0, g:mark_ns, g:mark_id, {}) + echo nvim_buf_get_extmark_by_id(0, g:mark_ns, g:mark_id) " => [0, 2] We can get all marks in a buffer by |namespace| (or by a range): >vim - echo nvim_buf_get_extmarks(0, g:mark_ns, 0, -1, {}) + echo nvim_buf_get_extmarks(0, g:mark_ns, 0, -1) " => [[1, 0, 2]] Deleting all surrounding text does NOT remove an extmark! To remove extmarks @@ -528,7 +528,7 @@ use |nvim_buf_del_extmark()|. Deleting "x" in our example: > ^ extmark position < >vim - echo nvim_buf_get_extmark_by_id(0, g:mark_ns, g:mark_id, {}) + echo nvim_buf_get_extmark_by_id(0, g:mark_ns, g:mark_id) " => [0, 1] < Note: Extmark "gravity" decides how it will shift after a text edit. @@ -674,7 +674,7 @@ nvim_echo({chunks}, {history}, {opts}) *nvim_echo()* avoid unintentional conflicts. 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) < Attributes: ~ @@ -1283,7 +1283,7 @@ nvim_open_term({buf}, {opts}) *nvim_open_term()* ANSI termcodes, so you can use Nvim as a "scrollback pager" (for terminals like kitty): *ansi-colorize* *terminal-scrollback-pager* >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' }) < @@ -3170,8 +3170,8 @@ nvim_buf_get_extmarks({buf}, {ns_id}, {start}, {end}, {opts}) Region can be given as (row,col) tuples, or valid extmark ids (whose positions define the bounds). 0 and -1 are understood as (0,0) and (-1,-1) 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. @@ -3193,13 +3193,13 @@ nvim_buf_get_extmarks({buf}, {ns_id}, {start}, {end}, {opts}) 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) < diff --git a/runtime/doc/lua-guide.txt b/runtime/doc/lua-guide.txt index 5179ace04e..5b135d4f22 100644 --- a/runtime/doc/lua-guide.txt +++ b/runtime/doc/lua-guide.txt @@ -685,7 +685,7 @@ takes three mandatory arguments: Example: >lua - vim.api.nvim_create_user_command('Test', 'echo "It works!"', {}) + vim.api.nvim_create_user_command('Test', 'echo "It works!"') vim.cmd.Test() --> It works! < diff --git a/runtime/lua/nvim/dir.lua b/runtime/lua/nvim/dir.lua index 23d4d8c09d..3448fb3eab 100644 --- a/runtime/lua/nvim/dir.lua +++ b/runtime/lua/nvim/dir.lua @@ -121,7 +121,7 @@ end ---@param path string local function edit(path) navigating = true - api.nvim_cmd({ cmd = 'edit', args = { path }, magic = { file = false, bar = false } }, {}) + api.nvim_cmd({ cmd = 'edit', args = { path }, magic = { file = false, bar = false } }) navigating = false end diff --git a/runtime/lua/nvim/tutor.lua b/runtime/lua/nvim/tutor.lua index fb6693024c..8fdcbfe397 100644 --- a/runtime/lua/nvim/tutor.lua +++ b/runtime/lua/nvim/tutor.lua @@ -87,7 +87,7 @@ function M.apply_marks() invalidate = true, }) - local mark_id = vim.api.nvim_buf_set_extmark(0, tutor_mark_ns, lnum - 1, 0, {}) + local mark_id = vim.api.nvim_buf_set_extmark(0, tutor_mark_ns, lnum - 1, 0) -- Cannot edit field of a Vimscript dictionary from Lua directly, see `:h lua-vim-variables` ---@type nvim.TutorExtmarks 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 diff --git a/src/nvim/api/command.c b/src/nvim/api/command.c index fa1a12fe4f..6bdbdeaa0c 100644 --- a/src/nvim/api/command.c +++ b/src/nvim/api/command.c @@ -462,7 +462,7 @@ String nvim_cmd(uint64_t channel_id, Dict(cmd) *cmd, Dict(cmd_opts) *opts, Arena is_numeric = true; count_value = first_arg.data.integer; } else if (first_arg.type == kObjectTypeString) { - // Try to parse string as a number Example: vim.api.nvim_cmd({cmd = 'copen', args = {'10'}}, {}) + // Try to parse string as a number Example: vim.api.nvim_cmd({cmd = 'copen', args = {'10'}}) char *endptr = first_arg.data.string.data; long val = getdigits_long(&endptr, false, 0); // Check if entire string was consumed (valid number) and string is not empty diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c index 3ed1ce15fc..d3958aaa8c 100644 --- a/src/nvim/api/deprecated.c +++ b/src/nvim/api/deprecated.c @@ -1010,7 +1010,7 @@ Object nvim_notify(String msg, Integer log_level, Dict opts, Arena *arena, Error /// @deprecated /// -/// Use |nvim_win_resize()| instead, e.g., nvim_win_resize(win, -1, height, {}) +/// Use |nvim_win_resize()| instead, e.g., nvim_win_resize(win, -1, height) /// /// Sets the window height. /// @@ -1033,7 +1033,7 @@ void nvim_win_set_height(Window win, Integer height, Error *err) /// @deprecated /// -/// Use |nvim_win_resize()| instead, e.g., nvim_win_resize(win, width, -1, {}) +/// Use |nvim_win_resize()| instead, e.g., nvim_win_resize(win, width, -1) /// /// Sets the window width. This will only succeed if the screen is split /// vertically. diff --git a/src/nvim/api/extmark.c b/src/nvim/api/extmark.c index c2872e8ab0..246eb9fd88 100644 --- a/src/nvim/api/extmark.c +++ b/src/nvim/api/extmark.c @@ -240,8 +240,8 @@ nvim_buf_get_extmark_by_id(Buffer buf, Integer ns_id, Integer id, Dict(get_extma /// 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. @@ -265,13 +265,13 @@ nvim_buf_get_extmark_by_id(Buffer buf, Integer ns_id, Integer id, Dict(get_extma /// 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) /// ``` /// diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 66956fc946..fe443573b8 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -806,7 +806,7 @@ void nvim_set_vvar(String name, Object value, Error *err) /// /// 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 List of `[text, hl_group]` pairs, where each is a `text` string highlighted by @@ -1129,7 +1129,7 @@ Buffer nvim_create_buf(Boolean listed, Boolean scratch, Error *err) /// /// ```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' }) /// ``` ///