local function map(mode, lhs, rhs, info) vim.keymap.set(mode, lhs, rhs, { desc = info }) end -- Basics map("n", ";", ":", "Command mode") map("n", "U", "redo", "Redo") map({ "i", "n" }, "", "noh", "Clear search") map({ "i", "n", "s", "v" }, "", "w", "Save file") map("n", "", "^Da", "Rewrite line") map("i", "", "^Da", "Rewrite line") map("n", "", "ggVG", "Select all") map({ "n", "v" }, "", "^", "Beginning of line") map("i", "", "^i", "Beginning of line") map({ "i", "n", "v" }, "", "", "End of line") map("n", "qq", "qa!", "Quit all") -- Editing multiple instances map("n", "", "*#", "Search word under cursor") map("n", "", "*#:%s//", "Replace word under cursor") map("v", "", "y/\"N", "Search selection") map("v", "", "y/\"N:%s//\"", "Replace selection") -- Increasing and decreasing numbers map("n", "+", "", "Increase number") map("n", "-", "", "Decrease number") map("n", "", "", "Increase number") map("n", "", "", "Decrease number") -- Buffer management map("n", "", "enew", "New file") map("n", "", "bd", "Delete buffer") -- Copy and paste map("v", "", "y") map("n", "", '"+p') -- Indenting map("v", "<", "", ">gv") -- Shift arrow selection map("n", "", "v") map("n", "", "v") map("n", "", "v") map("n", "", "v") map("v", "", "") map("v", "", "") map("v", "", "") map("v", "", "") map("i", "", "v") map("i", "", "v") map("i", "", "v") map("i", "", "v") -- LSP map("n", "gr", vim.lsp.buf.references, "References") map("n", "gd", vim.lsp.buf.definition, "Definition") map({ "n", "i" }, "", vim.lsp.buf.hover, "Hover") map({ "n", "i" }, "", vim.lsp.buf.rename, "Rename") map({ "n", "i" }, "", vim.lsp.buf.format, "Format") map("n", "ca", vim.lsp.buf.code_action, "Code action") -- Package manager map("n", "l", "Lazy", "Lazy")