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