fix(mappings): fix mapset() not replacing map with backslash (#26719)

This commit is contained in:
zeertzjq
2023-12-23 15:30:44 +08:00
committed by GitHub
parent 242261d4e7
commit 3c667d3e0f
2 changed files with 11 additions and 1 deletions

View File

@@ -180,6 +180,16 @@ end)
describe('mapset()', function()
before_each(clear)
it('can restore mapping with backslash in lhs', function()
meths.set_keymap('n', '\\ab', 'a', {})
eq('\nn \\ab a', exec_capture("nmap \\ab"))
local mapargs = funcs.maparg('\\ab', 'n', false, true)
meths.set_keymap('n', '\\ab', 'b', {})
eq('\nn \\ab b', exec_capture("nmap \\ab"))
funcs.mapset('n', false, mapargs)
eq('\nn \\ab a', exec_capture("nmap \\ab"))
end)
it('can restore mapping description from the dict returned by maparg()', function()
meths.set_keymap('n', 'lhs', 'rhs', {desc = 'map description'})
eq('\nn lhs rhs\n map description', exec_capture("nmap lhs"))