From 62ad3ea1a93d0d28b4ed5cd198b6177e7e15c4f2 Mon Sep 17 00:00:00 2001 From: Wassim Metallaoui Date: Wed, 5 Jun 2024 15:05:31 -0500 Subject: [PATCH] feat!: stop capturing patterns with () for \1 and use & instead The & captures the pattern already and can be used in the replacement text. --- lua/scalpel/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/scalpel/init.lua b/lua/scalpel/init.lua index 16d8784..0f3244d 100644 --- a/lua/scalpel/init.lua +++ b/lua/scalpel/init.lua @@ -64,7 +64,7 @@ function M.substitute() elseif is_blank(word) then vim.notify('Selection is blank, cannot substitute', vim.log.levels.INFO) else - local pattern = ':%s/\\v(' .. word .. ')//gc' + local pattern = ':%s/\\v' .. word .. '//gc' local cursor_move = vim.api.nvim_replace_termcodes('', true, false, true) vim.api.nvim_feedkeys(pattern .. cursor_move, 'n', true) end