feat: fixed & added mappings & users can now add their custom "mode_opt"
This commit is contained in:
parent
63651e90e6
commit
c7a4d4e337
2 changed files with 23 additions and 6 deletions
|
@ -228,7 +228,7 @@ M.telescope = {
|
|||
["<leader>fb"] = { "<cmd> Telescope buffers <CR>", " find buffers" },
|
||||
["<leader>fh"] = { "<cmd> Telescope help_tags <CR>", " help page" },
|
||||
["<leader>fo"] = { "<cmd> Telescope oldfiles <CR>", " find oldfiles" },
|
||||
["<leader>tk"] = { "<cmd> Telescope keys <CR>", " show keys" },
|
||||
["<leader>tk"] = { "<cmd> Telescope keymaps <CR>", " show keys" },
|
||||
|
||||
-- git
|
||||
["<leader>cm"] = { "<cmd> Telescope git_commits <CR>", " git commits" },
|
||||
|
@ -285,4 +285,20 @@ M.nvterm = {
|
|||
},
|
||||
}
|
||||
|
||||
M.whichkey = {
|
||||
n = {
|
||||
["<leader>wK"] = {
|
||||
function()
|
||||
vim.cmd("WhichKey")
|
||||
end, " which-key all keymaps",
|
||||
},
|
||||
["<leader>wk"] = {
|
||||
function()
|
||||
local input = vim.fn.input("WhichKey: ")
|
||||
vim.cmd("WhichKey " .. input)
|
||||
end, " which-key query lookup",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
return M
|
||||
|
|
|
@ -61,9 +61,10 @@ 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)
|
||||
for _, value in pairs(mappings) do
|
||||
if value[mode] then
|
||||
local mode_opts = value["mode_opts"] and vim.tbl_deep_extend("force", opt, value["mode_opts"]) or opt
|
||||
wk.register(value[mode], mode_opts)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue