feat(mappings): considering map description when filtering (#17423)

This commit is contained in:
Shadman
2022-02-16 14:39:50 +06:00
committed by GitHub
parent deb33a9775
commit 9a74c2b04a
3 changed files with 21 additions and 8 deletions

View File

@@ -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 <nop> as map rhs', function()
meths.set_keymap('n', 'asdf', '<nop>', {})
eq('\nn asdf <Nop>', 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 <nop> as map rhs', function()
meths.set_keymap('n', 'asdf', '<nop>', {})
eq('\nn asdf <Nop>', helpers.exec_capture('nmap asdf'))
end)
end)