From 9a74c2b04ac8f54a17925a437b5a2f03b18f6281 Mon Sep 17 00:00:00 2001 From: Shadman <13149513+shadmansaleh@users.noreply.github.com> Date: Wed, 16 Feb 2022 14:39:50 +0600 Subject: feat(mappings): considering map description when filtering (#17423) --- test/functional/api/keymap_spec.lua | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/functional/api/keymap_spec.lua b/test/functional/api/keymap_spec.lua index 06b699193a..e49e0b8cc4 100644 --- a/test/functional/api/keymap_spec.lua +++ b/test/functional/api/keymap_spec.lua @@ -877,6 +877,24 @@ describe('nvim_set_keymap, nvim_del_keymap', function() eq("\nn lhs rhs\n map description", helpers.exec_capture("nmap lhs")) end) + + it ('can :filter maps based on description', function() + meths.set_keymap('n', 'asdf1', 'qwert', {desc='do the one thing'}) + meths.set_keymap('n', 'asdf2', 'qwert', {desc='doesnot really do anything'}) + meths.set_keymap('n', 'asdf3', 'qwert', {desc='do the other thing'}) + eq([[ + +n asdf3 qwert + do the other thing +n asdf1 qwert + do the one thing]], + helpers.exec_capture('filter the nmap')) + end) + + it ('shows as map rhs', function() + meths.set_keymap('n', 'asdf', '', {}) + eq('\nn asdf ', helpers.exec_capture('nmap asdf')) + end) end) describe('nvim_buf_set_keymap, nvim_buf_del_keymap', function() @@ -1037,9 +1055,4 @@ describe('nvim_buf_set_keymap, nvim_buf_del_keymap', function() eq(1, exec_lua[[return GlobalCount]]) eq('\nNo mapping found', helpers.exec_capture('nmap asdf')) end) - - it ('shows as map rhs', function() - meths.set_keymap('n', 'asdf', '', {}) - eq('\nn asdf ', helpers.exec_capture('nmap asdf')) - end) end) -- cgit