mirror of
https://github.com/neovim/neovim.git
synced 2025-12-16 03:15:39 +00:00
feat(mappings): considering map description when filtering (#17423)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user