mirror of
https://github.com/neovim/neovim.git
synced 2026-08-02 13:49:19 +00:00
fix(api): add lhs option for keymap deletion
This commit is contained in:
16
runtime/lua/vim/_meta/api.gen.lua
generated
16
runtime/lua/vim/_meta/api.gen.lua
generated
@@ -333,9 +333,11 @@ function vim.api.nvim_buf_del_extmark(buf, ns_id, id) end
|
||||
---
|
||||
--- @see vim.api.nvim_del_keymap
|
||||
--- @param buf integer Buffer id, or 0 for current buffer
|
||||
--- @param mode string
|
||||
--- @param lhs string
|
||||
function vim.api.nvim_buf_del_keymap(buf, mode, lhs) end
|
||||
--- @param mode string Mode short-name ("n", "i", "v", ...)
|
||||
--- @param lhs string Left-hand-side `{lhs}` of the mapping.
|
||||
--- @param opts vim.api.keyset.keymap_del? Optional parameters.
|
||||
--- - lhs: When true, only match {lhs}, not {rhs}.
|
||||
function vim.api.nvim_buf_del_keymap(buf, mode, lhs, opts) end
|
||||
|
||||
--- Deletes a named mark in the buffer. See `mark-motions`.
|
||||
---
|
||||
@@ -1069,9 +1071,11 @@ function vim.api.nvim_del_current_line() end
|
||||
--- To unmap a buffer-local mapping, use `nvim_buf_del_keymap()`.
|
||||
---
|
||||
--- @see vim.api.nvim_set_keymap
|
||||
--- @param mode string
|
||||
--- @param lhs string
|
||||
function vim.api.nvim_del_keymap(mode, lhs) end
|
||||
--- @param mode string Mode short-name ("n", "i", "v", ...)
|
||||
--- @param lhs string Left-hand-side `{lhs}` of the mapping.
|
||||
--- @param opts vim.api.keyset.keymap_del? Optional parameters.
|
||||
--- - lhs: When true, only match {lhs}, not {rhs}.
|
||||
function vim.api.nvim_del_keymap(mode, lhs, opts) end
|
||||
|
||||
--- Deletes an uppercase/file named mark. See `mark-motions`.
|
||||
---
|
||||
|
||||
3
runtime/lua/vim/_meta/api_keysets.gen.lua
generated
3
runtime/lua/vim/_meta/api_keysets.gen.lua
generated
@@ -373,6 +373,9 @@ error('Cannot require a meta file')
|
||||
--- @field silent? boolean
|
||||
--- @field unique? boolean
|
||||
|
||||
--- @class vim.api.keyset.keymap_del
|
||||
--- @field lhs? boolean
|
||||
|
||||
--- @class vim.api.keyset.ns_opts
|
||||
--- @field wins? any[]
|
||||
|
||||
|
||||
@@ -119,8 +119,11 @@ end
|
||||
---
|
||||
--- Remove a mapping from the given buffer. `0` for current.
|
||||
--- @field buf? integer
|
||||
--- When true, only match {lhs}, not {rhs}.
|
||||
--- @field lhs? boolean
|
||||
|
||||
--- Removes a mapping, or removes each (mode, lhs) pair if `lhs` is a list.
|
||||
---
|
||||
--- Examples:
|
||||
---
|
||||
--- ```lua
|
||||
@@ -152,12 +155,14 @@ function keymap.del(modes, lhs, opts)
|
||||
buf = opts.buffer == true and 0 or opts.buffer --[[@as integer?]]
|
||||
end
|
||||
|
||||
local api_opts = { lhs = opts.lhs }
|
||||
|
||||
for _, m in ipairs(modes) do
|
||||
for _, l in ipairs(lhs) do
|
||||
if buf then
|
||||
vim.api.nvim_buf_del_keymap(buf, m, l)
|
||||
vim.api.nvim_buf_del_keymap(buf, m, l, api_opts)
|
||||
else
|
||||
vim.api.nvim_del_keymap(m, l)
|
||||
vim.api.nvim_del_keymap(m, l, api_opts)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user