mirror of
https://github.com/CompeyDev/my-nvim-setup.git
synced 2024-12-13 13:30:41 +00:00
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
|
@ -224,11 +224,11 @@ M.telescope = {
|
|||
-- find
|
||||
["<leader>ff"] = { "<cmd> Telescope find_files <CR>", " find files" },
|
||||
["<leader>fa"] = { "<cmd> Telescope find_files follow=true no_ignore=true hidden=true <CR>", " find all" },
|
||||
["<leader>fw"] = { "<cmd> Telescope live_grep <CR>", " live grep" },
|
||||
["<leader>fw"] = { "<cmd> Telescope live_grep <CR>", " live grep" },
|
||||
["<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>fo"] = { "<cmd> Telescope oldfiles <CR>", " find oldfiles" },
|
||||
["<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