-- INFO: Maps leader to 'space' vim.g.mapleader = " " -- TIP: Unmap keymaps -- ─< lua/keymaps.lua >───────────────────────────────────────────────────────────────── local nomap = vim.keymap.set nomap("i", "", "") nomap("n", "", "") nomap("n", "q", "") nomap("v", "q", "") nomap("v", "S", "") -- INFO: vim.keymap.set with map() local map = vim.keymap.set map("n", "", "nohlsearch") -- ─< Comment >───────────────────────────────────────────────────────────────────────── -- INFO: makes instant comments, no plugin needet map("n", "", "gcc", { desc = "comment toggle", remap = true }) map("v", "", "gc", { desc = "comment toggle", remap = true }) -- ─< Movement while in "insert"-mode >───────────────────────────────────────────────── map("i", "", "^i", { desc = "move beginning of line" }) map("i", "", "", { desc = "move end of line" }) map("i", "", "", { desc = "move left" }) map("i", "", "", { desc = "move right" }) map("i", "", "", { desc = "move down" }) map("i", "", "", { desc = "move up" }) map("n", ";", ":", { desc = "CMD enter command mode" }) -- CTRL-C for escape map({ "i", "n", "v" }, "", "") map("n", "x", "bd!") -- ─< Disable arrow keys in normal mode >─────────────────────────────────────────────── map("n", "", 'echo "Use h to move!!"') map("n", "", 'echo "Use l to move!!"') map("n", "", 'echo "Use k to move!!"') map("n", "", 'echo "Use j to move!!"') map("n", "l", "", { desc = "Move focus to the right window" }) map("n", "h", "", { desc = "Move focus to the left window" }) map("n", "j", "", { desc = "Move focus to the lower window" }) map("n", "k", "", { desc = "Move focus to the upper window" }) -- map("n", "p", vim.cmd.Ex) map("n", "q", vim.cmd.q) map("n", "Q", "q!") map("n", "s", vim.cmd.w) map("n", "", vim.cmd.w) -- Visual mode: Indent selected lines -- INFO: got removed becouse of the mini-move plugin -- map("v", "", ">gv", { desc = "Indent and keep selection" }) -- map("v", "", "sv", "v", { desc = "Split window vertically" }) -- split window vertically map("n", "sh", "s", { desc = "Split window horizontally" }) -- split window horizontally -- ─< Terminal >──────────────────────────────────────────────────────────────────────── -- NOTE: This is only for terminal mode map("t", "", "", { desc = "terminal escape terminal mode" }) -- ──────────────────────────────< rename word under cursor >────────────────────────────── -- map("n", "R", [[:%s/\<\>//gI]]) -- ───────────────< Enhanced word under cursor renaming in current buffer >──────────── map({ "n", "x" }, "R", function() local text = vim.fn.mode() == "n" and vim.fn.expand("") or vim.fn.trim(vim.fn.getreg('"')) vim.ui.input({ prompt = "Replace: ", default = text }, function(input) if input and input ~= text then vim.cmd(("keeppatterns %%s/%s/%s/g"):format(vim.pesc(text), vim.pesc(input))) end end) end, { desc = "Rename in buffer" })