aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorshadmansaleh <13149513+shadmansaleh@users.noreply.github.com>2022-01-07 17:28:14 +0600
committershadmansaleh <13149513+shadmansaleh@users.noreply.github.com>2022-02-27 08:21:21 +0600
commit0347875a5c11258ebb6377a1ab79b04fe9c55bc9 (patch)
tree695e136b1f68b72cf3244ed424e340e41acf51b4 /test
parent84812bcc2c5577d387ab59048bf18ad443bdf79b (diff)
downloadrneovim-0347875a5c11258ebb6377a1ab79b04fe9c55bc9.tar.gz
rneovim-0347875a5c11258ebb6377a1ab79b04fe9c55bc9.tar.bz2
rneovim-0347875a5c11258ebb6377a1ab79b04fe9c55bc9.zip
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 84d5bc2335..160c7cf126 100644
--- a/test/functional/ex_cmds/map_spec.lua
+++ b/test/functional/ex_cmds/map_spec.lua
@@ -6,6 +6,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)
@@ -25,4 +27,37 @@ 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)