2022-05-25 03:06:58 -04:00
|
|
|
local M = {}
|
|
|
|
|
|
|
|
M.options = {
|
2022-05-12 08:56:01 -04:00
|
|
|
|
|
|
|
-- NOTE : this mode_opts table isnt in the default whichkey config
|
|
|
|
-- Its added here so you could configure it in chadrc
|
|
|
|
|
|
|
|
mode_opts = {
|
|
|
|
n = {
|
|
|
|
mode = "n",
|
|
|
|
},
|
|
|
|
|
|
|
|
v = {
|
|
|
|
mode = "v",
|
|
|
|
},
|
|
|
|
|
|
|
|
i = {
|
|
|
|
mode = "i",
|
|
|
|
},
|
|
|
|
|
|
|
|
t = {
|
|
|
|
mode = "t",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
icons = {
|
|
|
|
breadcrumb = "»", -- symbol used in the command line area that shows your active key combo
|
|
|
|
separator = " ", -- symbol used between a key and it's label
|
|
|
|
group = "+", -- symbol prepended to a group
|
|
|
|
},
|
|
|
|
|
|
|
|
popup_mappings = {
|
|
|
|
scroll_down = "<c-d>", -- binding to scroll down inside the popup
|
|
|
|
scroll_up = "<c-u>", -- binding to scroll up inside the popup
|
|
|
|
},
|
|
|
|
|
|
|
|
window = {
|
|
|
|
border = "none", -- none/single/double/shadow
|
|
|
|
},
|
|
|
|
|
|
|
|
layout = {
|
|
|
|
spacing = 6, -- spacing between columns
|
|
|
|
},
|
|
|
|
|
|
|
|
hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " },
|
|
|
|
|
|
|
|
triggers_blacklist = {
|
|
|
|
-- list of mode / prefixes that should never be hooked by WhichKey
|
|
|
|
i = { "j", "k" },
|
|
|
|
v = { "j", "k" },
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2022-05-25 03:06:58 -04:00
|
|
|
M.options = nvchad.load_override(M.options, "folke/which-key.nvim")
|
|
|
|
|
|
|
|
M.setup = function()
|
2022-05-26 11:49:13 -04:00
|
|
|
local present, wk = pcall(require, "which-key")
|
|
|
|
|
|
|
|
if not present then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2022-05-25 03:06:58 -04:00
|
|
|
local mappings = nvchad.load_config().mappings
|
|
|
|
local mapping_groups = { groups = vim.deepcopy(mappings.groups) }
|
2022-05-22 07:06:24 -04:00
|
|
|
|
2022-05-25 03:06:58 -04:00
|
|
|
mappings.disabled = nil
|
|
|
|
mappings.groups = nil
|
2022-05-21 03:03:19 -04:00
|
|
|
|
2022-05-25 03:06:58 -04:00
|
|
|
nvchad.whichKey_map(mappings, M.options)
|
|
|
|
nvchad.whichKey_map(mapping_groups, M.options)
|
2022-05-12 08:56:01 -04:00
|
|
|
|
2022-05-25 03:06:58 -04:00
|
|
|
wk.setup(M.options)
|
|
|
|
end
|
2022-05-16 08:31:47 -04:00
|
|
|
|
2022-05-25 03:06:58 -04:00
|
|
|
return M
|