From 22d44ef8754448294833fcbc197defaca355f3b5 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Sat, 25 Jul 2026 10:26:01 -0700 Subject: fix(api): add `lhs` option for keymap deletion --- test/functional/lua/vim_spec.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test/functional/lua/vim_spec.lua') diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua index 844bef111f..03ceb6345f 100644 --- a/test/functional/lua/vim_spec.lua +++ b/test/functional/lua/vim_spec.lua @@ -3049,6 +3049,23 @@ describe('vim.keymap', function() eq('\nNo mapping found', n.exec_capture('nmap qwer')) end) + it('unmap with lhs option', function() + eq( + 'q', + exec_lua [[ + vim.keymap.set('n', 'ge', 'q') + local ok, err = pcall(vim.keymap.del, 'n', 'q', { lhs = true }) + assert(not ok and err:match('E31: No such mapping'), err) + return vim.fn.maparg('ge', 'n') + ]] + ) + + exec_lua [[ + vim.keymap.del('n', 'ge', { lhs = true }) + ]] + eq('\nNo mapping found', n.exec_capture('nmap ge')) + end) + it('buffer-local mappings', function() eq( 0, -- cgit