-- Keymaps are automatically loaded on the VeryLazy event -- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua local function unmap(mode, key) vim.keymap.del(mode, key, {}) end local function map(mode, lhs, rhs, opts) local keys = require("lazy.core.handler").handlers.keys ---@cast keys LazyKeysHandler -- do not create the keymap if a lazy keys handler exists if not keys.active[keys.parse({ lhs, mode = mode }).id] then opts = opts or {} opts.silent = opts.silent ~= false if opts.remap and not vim.g.vscode then opts.remap = nil end vim.keymap.set(mode, lhs, rhs, opts) end end -- Unbind stuff relating to splitting windows unmap("n", "ww") unmap("n", "w-") unmap("n", "w|") unmap("n", "wd") require("which-key").register({ ["w"] = "which_key_ignore", }) -- Restore "H" & "L" from neovim unmap("n", "H") unmap("n", "L") -- Unbind moving lines with ALT in INSERT mode unmap("i", "") unmap("i", "") -- Move ":Lazy" from "l" to "cm" unmap("n", "l") map("n", "cl", "Lazy", { desc = "Lazy" }) map("n", "0", "0^", { desc = "which_key_ignore " }) map("n", "", "o", { desc = "which_key_ignore " }) map("n", "", "zz", { desc = "which_key_ignore " }) map("n", "", "zz", { desc = "which_key_ignore " }) map("n", "w", "w", { desc = "which_key_ignore", nowait = true }) map("n", "Q", "qa", { desc = "which_key_ignore" }) map("n", "q", "q", { desc = "which_key_ignore", nowait = true }) -- Clipboard map("n", "y", [["+y]], { desc = "which_key_ignore" }) map("n", "p", [["+p]], { desc = "which_key_ignore" }) map("n", "", "h", { desc = "Go to left window", remap = true }) map("n", "", "j", { desc = "Go to lower window", remap = true }) map("n", "", "k", { desc = "Go to upper window", remap = true }) map("n", "", "l", { desc = "Go to right window", remap = true })