From cc8164aef92fb7b854ce436e4ce4e57b25f63fba Mon Sep 17 00:00:00 2001 From: Oscar Wallberg Date: Sat, 6 Sep 2025 01:26:34 +0200 Subject: [PATCH] feat(mappings): add mapping to replace all occurrences of a word --- lua/ow/core/mappings.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lua/ow/core/mappings.lua b/lua/ow/core/mappings.lua index f311aad..d905840 100644 --- a/lua/ow/core/mappings.lua +++ b/lua/ow/core/mappings.lua @@ -100,6 +100,15 @@ vim.keymap.set('n', 've', function() end end) +-- Replace all occurrences of word +vim.keymap.set("n", "r", function() + local word = vim.fn.expand("") + local replacement = vim.fn.input('Replace "' .. word .. '" by? ') + if replacement ~= "" then + vim.cmd(":%s/\\<" .. word .. "\\>/" .. replacement .. "/g") + end +end) + -- Removed bindings vim.keymap.set('n', 'gr', '')