feat(builtin): implement filter for keymaps (#2462)
This commit is contained in:
@@ -1129,7 +1129,6 @@ internal.registers = function(opts)
|
||||
:find()
|
||||
end
|
||||
|
||||
-- TODO: make filtering include the mapping and the action
|
||||
internal.keymaps = function(opts)
|
||||
opts.modes = vim.F.if_nil(opts.modes, { "n", "i", "c", "x" })
|
||||
opts.show_plug = vim.F.if_nil(opts.show_plug, true)
|
||||
@@ -1148,6 +1147,7 @@ internal.keymaps = function(opts)
|
||||
if
|
||||
(opts.show_plug or not string.find(keymap.lhs, "<Plug>"))
|
||||
and (not opts.lhs_filter or opts.lhs_filter(keymap.lhs))
|
||||
and (not opts.filter or opts.filter(keymap))
|
||||
then
|
||||
table.insert(keymaps_table, keymap)
|
||||
max_len_lhs = math.max(max_len_lhs, #utils.display_termcodes(keymap.lhs))
|
||||
|
||||
Reference in New Issue
Block a user