aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-02-27 16:47:55 +0100
committerGitHub <noreply@github.com>2022-02-27 16:47:55 +0100
commitc65d93e60adcacded822f0ad5d539042e600f523 (patch)
treefadf4755797c5f7e56bd73250ef29dbd9a745c94 /test
parent243869658e2ecc35b25a37bab59c04eb45231924 (diff)
parentc031e038df8429e14b0aa608aaa77068daa680f0 (diff)
downloadrneovim-c65d93e60adcacded822f0ad5d539042e600f523.tar.gz
rneovim-c65d93e60adcacded822f0ad5d539042e600f523.tar.bz2
rneovim-c65d93e60adcacded822f0ad5d539042e600f523.zip
Merge pull request #16969 from shadmansaleh/enhance/ingore_nore_on_plug_keymaps
feat: ignore nore on <Plug> maps
Diffstat (limited to 'test')
-rw-r--r--test/functional/ex_cmds/map_spec.lua35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/functional/ex_cmds/map_spec.lua b/test/functional/ex_cmds/map_spec.lua
index 75f644da0f..007d68d61a 100644
--- a/test/functional/ex_cmds/map_spec.lua
+++ b/test/functional/ex_cmds/map_spec.lua
@@ -8,6 +8,8 @@ local meths = helpers.meths
local clear = helpers.clear
local command = helpers.command
local expect = helpers.expect
+local insert = helpers.insert
+local eval = helpers.eval
describe(':*map', function()
before_each(clear)
@@ -27,6 +29,39 @@ describe(':*map', function()
feed('i-<M-">-')
expect('-foo-')
end)
+
+ it('<Plug> keymaps ignore nore', function()
+ command('let x = 0')
+ eq(0, meths.eval('x'))
+ command [[
+ nnoremap <Plug>(Increase_x) <cmd>let x+=1<cr>
+ nmap increase_x_remap <Plug>(Increase_x)
+ nnoremap increase_x_noremap <Plug>(Increase_x)
+ ]]
+ feed('increase_x_remap')
+ eq(1, meths.eval('x'))
+ feed('increase_x_noremap')
+ eq(2, meths.eval('x'))
+ end)
+ it("Doesn't auto ignore nore for keys before or after <Plug> keymap", function()
+ command('let x = 0')
+ eq(0, meths.eval('x'))
+ command [[
+ nnoremap x <nop>
+ nnoremap <Plug>(Increase_x) <cmd>let x+=1<cr>
+ nmap increase_x_remap x<Plug>(Increase_x)x
+ nnoremap increase_x_noremap x<Plug>(Increase_x)x
+ ]]
+ insert("Some text")
+ eq('Some text', eval("getline('.')"))
+
+ feed('increase_x_remap')
+ eq(1, meths.eval('x'))
+ eq('Some text', eval("getline('.')"))
+ feed('increase_x_noremap')
+ eq(2, meths.eval('x'))
+ eq('Some te', eval("getline('.')"))
+ end)
end)
describe(':*map cursor and redrawing', function()