mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 11:58:17 +00:00
chore: remove <Plug> detection from vim.keymap
This commit is contained in:
@@ -1994,9 +1994,7 @@ set({mode}, {lhs}, {rhs}, {opts}) *vim.keymap.set()*
|
|||||||
result of Lua expr maps.
|
result of Lua expr maps.
|
||||||
• remap: (boolean) Make the mapping recursive.
|
• remap: (boolean) Make the mapping recursive.
|
||||||
This is the inverse of the "noremap" option from
|
This is the inverse of the "noremap" option from
|
||||||
|nvim_set_keymap()|. Default `true` if `lhs` is
|
|nvim_set_keymap()|. Default `false` .
|
||||||
a string starting with `<plug>`
|
|
||||||
(case-insensitive), `false` otherwise.
|
|
||||||
|
|
||||||
See also: ~
|
See also: ~
|
||||||
|nvim_set_keymap()|
|
|nvim_set_keymap()|
|
||||||
|
@@ -42,7 +42,7 @@ local keymap = {}
|
|||||||
--- |nvim_replace_termcodes()| is applied to the result of Lua expr maps.
|
--- |nvim_replace_termcodes()| is applied to the result of Lua expr maps.
|
||||||
--- - remap: (boolean) Make the mapping recursive. This is the
|
--- - remap: (boolean) Make the mapping recursive. This is the
|
||||||
--- inverse of the "noremap" option from |nvim_set_keymap()|.
|
--- inverse of the "noremap" option from |nvim_set_keymap()|.
|
||||||
--- Default `true` if `lhs` is a string starting with `<plug>` (case-insensitive), `false` otherwise.
|
--- Default `false`.
|
||||||
---@see |nvim_set_keymap()|
|
---@see |nvim_set_keymap()|
|
||||||
function keymap.set(mode, lhs, rhs, opts)
|
function keymap.set(mode, lhs, rhs, opts)
|
||||||
vim.validate {
|
vim.validate {
|
||||||
@@ -66,8 +66,8 @@ function keymap.set(mode, lhs, rhs, opts)
|
|||||||
opts.replace_keycodes = nil
|
opts.replace_keycodes = nil
|
||||||
|
|
||||||
if opts.remap == nil then
|
if opts.remap == nil then
|
||||||
-- remap by default on <plug> mappings and don't otherwise.
|
-- default remap value is false
|
||||||
opts.noremap = is_rhs_luaref or rhs:lower():match("^<plug>") == nil
|
opts.noremap = true
|
||||||
else
|
else
|
||||||
-- remaps behavior is opposite of noremap option.
|
-- remaps behavior is opposite of noremap option.
|
||||||
opts.noremap = not opts.remap
|
opts.noremap = not opts.remap
|
||||||
|
Reference in New Issue
Block a user