From 0347875a5c11258ebb6377a1ab79b04fe9c55bc9 Mon Sep 17 00:00:00 2001 From: shadmansaleh <13149513+shadmansaleh@users.noreply.github.com> Date: Fri, 7 Jan 2022 17:28:14 +0600 Subject: feat: ignore nore on maps --- runtime/doc/map.txt | 3 +++ runtime/doc/vim_diff.txt | 3 +++ 2 files changed, 6 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 358e944261..e73bf3c453 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -65,6 +65,9 @@ modes. where the map command applies. Disallow mapping of {rhs}, to avoid nested and recursive mappings. Often used to redefine a command. + Note: "nore" is ignored for a mapping whose result + starts with . is always remapped even if + "nore" is used. :unm[ap] {lhs} |mapmode-nvo| *:unm* *:unmap* diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 5ea6a9c5dd..d7a65756bf 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -442,6 +442,9 @@ Working directory (Vim implemented some of these later than Nvim): - `getcwd(-1)` is equivalent to `getcwd(-1, 0)` instead of returning the global working directory. Use `getcwd(-1, -1)` to get the global working directory. +Mappings: +- |nore| is ignored for rhs mappings. mappings are always remapped. + ============================================================================== 5. Missing legacy features *nvim-features-missing* -- cgit From c031e038df8429e14b0aa608aaa77068daa680f0 Mon Sep 17 00:00:00 2001 From: shadmansaleh <13149513+shadmansaleh@users.noreply.github.com> Date: Fri, 7 Jan 2022 18:17:19 +0600 Subject: chore: remove detection from vim.keymap --- runtime/doc/lua.txt | 4 +--- runtime/lua/vim/keymap.lua | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 355c31090e..c91bd1b2ae 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -1994,9 +1994,7 @@ set({mode}, {lhs}, {rhs}, {opts}) *vim.keymap.set()* result of Lua expr maps. • remap: (boolean) Make the mapping recursive. This is the inverse of the "noremap" option from - |nvim_set_keymap()|. Default `true` if `lhs` is - a string starting with `` - (case-insensitive), `false` otherwise. + |nvim_set_keymap()|. Default `false` . See also: ~ |nvim_set_keymap()| diff --git a/runtime/lua/vim/keymap.lua b/runtime/lua/vim/keymap.lua index d53b790746..df49eff4b6 100644 --- a/runtime/lua/vim/keymap.lua +++ b/runtime/lua/vim/keymap.lua @@ -42,7 +42,7 @@ local keymap = {} --- |nvim_replace_termcodes()| is applied to the result of Lua expr maps. --- - remap: (boolean) Make the mapping recursive. This is the --- inverse of the "noremap" option from |nvim_set_keymap()|. ---- Default `true` if `lhs` is a string starting with `` (case-insensitive), `false` otherwise. +--- Default `false`. ---@see |nvim_set_keymap()| function keymap.set(mode, lhs, rhs, opts) vim.validate { @@ -66,8 +66,8 @@ function keymap.set(mode, lhs, rhs, opts) opts.replace_keycodes = nil if opts.remap == nil then - -- remap by default on mappings and don't otherwise. - opts.noremap = is_rhs_luaref or rhs:lower():match("^") == nil + -- default remap value is false + opts.noremap = true else -- remaps behavior is opposite of noremap option. opts.noremap = not opts.remap -- cgit