Skip to content

Commit

Permalink
feat!: stop capturing patterns with () for \1 and use & instead
Browse files Browse the repository at this point in the history
The & captures the pattern already and can be used in the replacement
text.
  • Loading branch information
wassimk committed Jun 5, 2024
1 parent d7d202d commit 62ad3ea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lua/scalpel/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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('<Left><Left><Left>', true, false, true)
vim.api.nvim_feedkeys(pattern .. cursor_move, 'n', true)
end
Expand Down

0 comments on commit 62ad3ea

Please sign in to comment.