chore(keymap): extract filtering into function
This commit is contained in:
@@ -245,12 +245,7 @@ function M.set_keymaps(bufnr)
|
||||
end
|
||||
end
|
||||
|
||||
local function get_keymaps(keys_to_disable)
|
||||
if keys_to_disable == true then
|
||||
return {}
|
||||
end
|
||||
|
||||
if type(keys_to_disable) == "table" and #keys_to_disable > 0 then
|
||||
local function filter_default_mappings(keys_to_disable)
|
||||
local new_map = {}
|
||||
for _, m in pairs(DEFAULT_KEYMAPS) do
|
||||
local keys = type(m.key) == "table" and m.key or { m.key }
|
||||
@@ -274,6 +269,15 @@ local function get_keymaps(keys_to_disable)
|
||||
end
|
||||
end
|
||||
return new_map
|
||||
end
|
||||
|
||||
local function get_keymaps(keys_to_disable)
|
||||
if keys_to_disable == true then
|
||||
return {}
|
||||
end
|
||||
|
||||
if type(keys_to_disable) == "table" and #keys_to_disable > 0 then
|
||||
return filter_default_mappings(keys_to_disable)
|
||||
end
|
||||
|
||||
return DEFAULT_KEYMAPS
|
||||
|
||||
Reference in New Issue
Block a user