breaking change : re-implement custom mappings | simplify it | add whichkey
fixes #1057 , #1047
This commit is contained in:
parent
4fa0b4ae7d
commit
0844431d37
15 changed files with 442 additions and 240 deletions
73
lua/plugins/configs/whichkey.lua
Normal file
73
lua/plugins/configs/whichkey.lua
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
local present, wk = pcall(require, "which-key")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
local options = {
|
||||
|
||||
-- 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" },
|
||||
},
|
||||
}
|
||||
|
||||
require("plugins.configs.others").misc_mappings()
|
||||
|
||||
local mappings = nvchad.load_config().mappings
|
||||
|
||||
-- register mappings
|
||||
for mode, opt in pairs(options.mode_opts) do
|
||||
for key, _ in pairs(mappings) do
|
||||
if mappings[key][mode] then
|
||||
wk.register(mappings[key][mode], opt)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
options = nvchad.load_override(options, "folke/which-key.nvim")
|
||||
|
||||
wk.setup(options)
|
||||
Loading…
Add table
Add a link
Reference in a new issue