Overview
The mapping configuration uses the nvim name shortcuts as:
<C>
-> Ctrl<leader>
-> Space<A>
-> alt<S>
-> shift- The default mappings are defined here.
Mapping format
- NvChad uses
vim.keymap.set
by default, check:h vim.keymap.set
for detailed docs. - The desc opt is optional. It's only needed for NvCheatsheet to document
local map = vim.keymap.set
map("n", "<leader>ff", "<cmd> Telescope <cr>")
-- multiple modes
map({ "i", "n" }, "<C-k>", "<Up>", { desc = "Move up" })
map({ "i", "n" }, "<C-j>", "<Down>", { desc = "Move down" })
-- mapping with a lua function
map("n", "<A-i>", function()
-- do something
end, { desc = "Terminal toggle floating" })
-- Disable mappings
local nomap = vim.keymap.del
nomap("i", "<C-k>")
nomap("n", "<C-k>")
- Please note that the above methods won't override LSP mappings because they are lazily loaded and don't load on startup.
local ooo = function(client, bufnr)
nvlsp.on_attach(client, bufnr)
-- map HERE
vim.keymap.set("n", "gd", "<cmd> Telescope<cr>", { buffer = bufnr })
end
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
on_attach = ooo,
on_init = nvlsp.on_init,
capabilities = nvlsp.capabilities,
}
end