This commit is contained in:
pika 2025-06-02 12:46:09 +02:00
parent bcdd3cdbd7
commit ac80409bb9
10 changed files with 292 additions and 138 deletions

View file

@ -9,6 +9,8 @@ nomap("n", "<C-k>", "")
nomap("n", "q", "")
nomap("v", "q", "")
nomap("v", "<leader>S", "")
-- nomap("n", "<C-A-Tab", "")
-- nomap("n", "<C-A-S-Tab", "")
-- INFO: vim.keymap.set with map()
local map = vim.keymap.set
@ -66,13 +68,14 @@ map("n", "<leader>sh", "<C-w>s", { desc = "Split window horizontally" }) -- spli
map("t", "<C-x>", "<C-\\><C-N>", { desc = "terminal escape terminal mode" })
-- ──────────────────────────────< rename word under cursor >──────────────────────────────
-- map("n", "<leader>R", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
map("n", "<leader>R", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
map("v", "<leader>R", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
-- ───────────────< Enhanced word under cursor renaming in current buffer >────────────
map({ "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" })
-- map({ "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" })