diff options
Diffstat (limited to 'lua')
-rw-r--r-- | lua/lualine/themes/onedarker.lua | 6 | ||||
-rw-r--r-- | lua/lvim/keymappings.lua | 17 |
2 files changed, 18 insertions, 5 deletions
diff --git a/lua/lualine/themes/onedarker.lua b/lua/lualine/themes/onedarker.lua index 85904eeb..7db197ab 100644 --- a/lua/lualine/themes/onedarker.lua +++ b/lua/lualine/themes/onedarker.lua @@ -1,7 +1,3 @@ --- Copyright (c) 2020-2021 shadmansaleh --- MIT license, see LICENSE for more details. --- Credit: Zoltan Dalmadi(lightline) --- LuaFormatter off local colors = { blue = "#61afef", green = "#98c379", @@ -16,7 +12,7 @@ local colors = { gray2 = "#2c323d", gray3 = "#3e4452", } --- LuaFormatter on + return { normal = { a = { fg = colors.gray2, bg = colors.blue, gui = "bold" }, diff --git a/lua/lvim/keymappings.lua b/lua/lvim/keymappings.lua index 62a351ee..44ea1654 100644 --- a/lua/lvim/keymappings.lua +++ b/lua/lvim/keymappings.lua @@ -119,6 +119,8 @@ end -- Append key mappings to lunarvim's defaults for a given mode -- @param keymaps The table of key mappings containing a list per mode (normal_mode, insert_mode, ..) function M.append_to_defaults(keymaps) + local default = M.get_defaults() + lvim.keys = lvim.keys or default for mode, mappings in pairs(keymaps) do for k, v in pairs(mappings) do defaults[mode][k] = v @@ -141,6 +143,21 @@ function M.clear(keymaps) end end +-- Unsets all keybindings defined in keymaps +-- @param keymaps The table of key mappings containing a list per mode (normal_mode, insert_mode, ..) +function M.clear(keymaps) + local default = M.get_defaults() + for mode, mappings in pairs(keymaps) do + local translated_mode = mode_adapters[mode] and mode_adapters[mode] or mode + for key, _ in pairs(mappings) do + -- some plugins may override default bindings that the user hasn't manually overriden + if default[mode][key] ~= nil or (default[translated_mode] ~= nil and default[translated_mode][key] ~= nil) then + pcall(vim.api.nvim_del_keymap, translated_mode, key) + end + end + end +end + -- Set key mappings individually -- @param mode The keymap mode, can be one of the keys of mode_adapters -- @param key The key of keymap |