feat(mappings): add mapping to replace all occurrences of a word

This commit is contained in:
2025-09-06 01:26:34 +02:00
parent a6fcb0b387
commit cc8164aef9
+9
View File
@@ -100,6 +100,15 @@ vim.keymap.set('n', '<leader>ve', function()
end end
end) end)
-- Replace all occurrences of word
vim.keymap.set("n", "<Leader>r", function()
local word = vim.fn.expand("<cword>")
local replacement = vim.fn.input('Replace "' .. word .. '" by? ')
if replacement ~= "" then
vim.cmd(":%s/\\<" .. word .. "\\>/" .. replacement .. "/g")
end
end)
-- Removed bindings -- Removed bindings
vim.keymap.set('n', 'gr', '<Nop>') vim.keymap.set('n', 'gr', '<Nop>')