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({"n", "v"}, "qq", "qa!", "Quit all") -- Editing lines map({ "n", "v" }, "", "^", "Beginning of line") map("i", "", "^i", "Beginning of line") map({ "i", "n", "v" }, "", "", "End of line") map("n", "", "^Da", "Rewrite line") map("i", "", "^Da", "Rewrite line") map("v", "", "V", "Select line") map({"n", "v"}, "", "ggVG", "Select all") -- Editing multiple instances map("n", "", "*#", "Search word under cursor") map("v", "", "y/\"N", "Search selection") map("n", "", "viw", "Select word under cursor") map("v", "", "y/\"N", "Search selection") map("n", "", "*#:%s///g", "Replace word under cursor") map("v", "", "y/\"N:%s//\"/g", "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({ "i", "n", "s", "v" }, "", "w", "Save file") map("n", "", "bd", "Delete buffer") -- Copy and paste map("v", "", "y") map("n", "", '"+p') -- Indenting map("n", "", "V>gv") map("n", "", "V") map("v", "", ">gv") map("v", "", "", "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") -- Package manager map("n", "l", "Lazy", "Lazy")