vim.g.mapleader = " " -- ─< lua/keymaps.lua >───────────────────────────────────────────────────────────────── local nomap = vim.keymap.set nomap("i", "", "") nomap("n", "", "") nomap("n", "q", "") nomap("v", "q", "") nomap("v", "S", "") local map = vim.keymap.set map("n", "", "nohlsearch") -- ─< Comment >───────────────────────────────────────────────────────────────────────── map("n", "", "gcc", { desc = "comment toggle", remap = true }) map("v", "", "gc", { desc = "comment toggle", remap = true }) -- ─< Terminal >──────────────────────────────────────────────────────────────────────── map("t", "", "", { desc = "terminal escape terminal mode" }) -- ─< 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" }) map("i", "jk", "") map("i", "", "") map("n", "", "") map("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", "s", vim.cmd.w) map("n", "", vim.cmd.w) -- Visual mode: Indent selected lines 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 -- ──────────────────────────────< rename word under cursor >────────────────────────────── -- map("n", "R", [[:%s/\<\>//gI]]) -- ──────────────────────< Enhanced word renaming in current buffer >────────────────────── -- -- Minimal working version vim.keymap.set({ "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" })