aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/keymap.lua
diff options
context:
space:
mode:
authorBryan Turns <95263942+BryanTurns@users.noreply.github.com>2025-12-20 18:26:44 -0600
committerGitHub <noreply@github.com>2025-12-20 19:26:44 -0500
commitbef68ba266038b94a532ce76e315dd71089939f3 (patch)
treefd794c07fa08e50758a6feed905c2d8ee907581d /runtime/lua/vim/keymap.lua
parent6228acb74f94ead074627c152faeed1b17f4e7d9 (diff)
downloadrneovim-bef68ba266038b94a532ce76e315dd71089939f3.tar.gz
rneovim-bef68ba266038b94a532ce76e315dd71089939f3.tar.bz2
rneovim-bef68ba266038b94a532ce76e315dd71089939f3.zip
docs(lua): iInconsistent vim.keymap param name #37026
Problem: vim.keymap.del has 'modes' as it's first argument while vim.keymap.set has 'mode' as it's first argument despite both 'mode' and 'modes' taking in the same type input of String or String[]. Solution: Updated vim.keymap.set docs to refer to it's first argument as 'modes'.
Diffstat (limited to 'runtime/lua/vim/keymap.lua')
-rw-r--r--runtime/lua/vim/keymap.lua14
1 files changed, 7 insertions, 7 deletions
diff --git a/runtime/lua/vim/keymap.lua b/runtime/lua/vim/keymap.lua
index 0c40abadfc..9273ebf2f4 100644
--- a/runtime/lua/vim/keymap.lua
+++ b/runtime/lua/vim/keymap.lua
@@ -44,7 +44,7 @@ local keymap = {}
--- end)
--- ```
---
----@param mode string|string[] Mode "short-name" (see |nvim_set_keymap()|), or a list thereof.
+---@param modes string|string[] Mode "short-name" (see |nvim_set_keymap()|), or a list thereof.
---@param lhs string Left-hand side |{lhs}| of the mapping.
---@param rhs string|function Right-hand side |{rhs}| of the mapping, can be a Lua function.
---@param opts? vim.keymap.set.Opts
@@ -53,16 +53,16 @@ local keymap = {}
---@see |maparg()|
---@see |mapcheck()|
---@see |mapset()|
-function keymap.set(mode, lhs, rhs, opts)
- vim.validate('mode', mode, { 'string', 'table' })
+function keymap.set(modes, lhs, rhs, opts)
+ vim.validate('modes', modes, { 'string', 'table' })
vim.validate('lhs', lhs, 'string')
vim.validate('rhs', rhs, { 'string', 'function' })
vim.validate('opts', opts, 'table', true)
opts = vim.deepcopy(opts or {}, true)
- ---@cast mode string[]
- mode = type(mode) == 'string' and { mode } or mode
+ ---@cast modes string[]
+ modes = type(modes) == 'string' and { modes } or modes
if opts.expr and opts.replace_keycodes ~= false then
opts.replace_keycodes = true
@@ -85,12 +85,12 @@ function keymap.set(mode, lhs, rhs, opts)
if opts.buffer then
local bufnr = opts.buffer == true and 0 or opts.buffer --[[@as integer]]
opts.buffer = nil ---@type integer?
- for _, m in ipairs(mode) do
+ for _, m in ipairs(modes) do
vim.api.nvim_buf_set_keymap(bufnr, m, lhs, rhs, opts)
end
else
opts.buffer = nil
- for _, m in ipairs(mode) do
+ for _, m in ipairs(modes) do
vim.api.nvim_set_keymap(m, lhs, rhs, opts)
end
end