wip
This commit is contained in:
parent
25790de5b4
commit
89322b376a
3 changed files with 24 additions and 2 deletions
|
@ -51,9 +51,23 @@ map("n", "<leader>q", vim.cmd.q)
|
|||
map("n", "<leader>s", vim.cmd.w)
|
||||
map("n", "<C-s>", vim.cmd.w)
|
||||
|
||||
-- ─< rename word under cursor >───────────────────────────────────────────────────────────
|
||||
map("n", "<leader>R", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
|
||||
-- Visual mode: Indent selected lines
|
||||
map("v", "<Tab>", ">gv", { desc = "Indent and keep selection" })
|
||||
map("v", "<S-Tab>", "<gv", { desc = "Unindent and keep selection" })
|
||||
|
||||
-- window management
|
||||
map("n", "<leader>sv", "<C-w>v", { desc = "Split window vertically" }) -- split window vertically
|
||||
map("n", "<leader>sh", "<C-w>s", { desc = "Split window horizontally" }) -- split window horizontally
|
||||
|
||||
-- ──────────────────────────────< rename word under cursor >──────────────────────────────
|
||||
-- map("n", "<leader>R", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
|
||||
-- ──────────────────────< Enhanced word renaming in current buffer >──────────────────────
|
||||
-- -- Minimal working version
|
||||
vim.keymap.set({ "n", "x" }, "<leader>R", function()
|
||||
local text = vim.fn.mode() == "n" and vim.fn.expand("<cword>") 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" })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue