Skip to content

Commit

Permalink
fix: do not remap keys on feedkeys
Browse files Browse the repository at this point in the history
Fix: #55
  • Loading branch information
gbprod committed Feb 21, 2023
1 parent 8acd0ac commit af1efe6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lua/substitute.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function substitute.operator(options)
substitute.state.register = options.register or vim.v.register
substitute.state.count = options.count or (vim.v.count > 0 and vim.v.count or 1)
vim.o.operatorfunc = "v:lua.require'substitute'.operator_callback"
vim.api.nvim_feedkeys("g@" .. (options.motion or ""), "i", false)
vim.api.nvim_feedkeys("g@" .. (options.motion or ""), "ni", false)
end

function substitute.operator_callback(vmode)
Expand Down Expand Up @@ -71,7 +71,7 @@ function substitute.visual(options)
substitute.state.register = options.register or vim.v.register
substitute.state.count = options.count or (vim.v.count > 0 and vim.v.count or 1)
vim.o.operatorfunc = "v:lua.require'substitute'.operator_callback"
vim.api.nvim_feedkeys("g@`<", "i", false)
vim.api.nvim_feedkeys("g@`<", "ni", false)
end

return substitute
2 changes: 1 addition & 1 deletion lua/substitute/exchange.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ end
function exchange.operator(options)
options = config.get_exchange(options or {})
vim.o.operatorfunc = "v:lua.require'substitute.exchange'.operator_callback"
vim.api.nvim_feedkeys(string.format("g@%s", options.motion or ""), "i", false)
vim.api.nvim_feedkeys(string.format("g@%s", options.motion or ""), "ni", false)
end

function exchange.visual(options)
Expand Down
6 changes: 3 additions & 3 deletions lua/substitute/range.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ range.state = {
function range.operator(options)
range.state.overrides = config.get_range(options or {})
vim.o.operatorfunc = "v:lua.require'substitute.range'.operator_callback"
vim.api.nvim_feedkeys(string.format("g@%s", range.state.overrides.motion1 or ""), "mi", false)
vim.api.nvim_feedkeys(string.format("g@%s", range.state.overrides.motion1 or ""), "ni", false)
end

function range.visual(options)
Expand Down Expand Up @@ -74,7 +74,7 @@ function range.operator_callback(vmode)
create_match(c)

vim.o.operatorfunc = "v:lua.require'substitute.range'.selection_operator_callback"
vim.api.nvim_feedkeys(string.format("g@%s", c.motion2 or ""), "mi", false)
vim.api.nvim_feedkeys(string.format("g@%s", c.motion2 or ""), "ni", false)
end

local function get_escaped_replacement(c)
Expand Down Expand Up @@ -107,7 +107,7 @@ end
function range.selection_operator_callback()
range.clear_match()

vim.api.nvim_feedkeys(range.create_replace_command(), "mi", true)
vim.api.nvim_feedkeys(range.create_replace_command(), "ni", true)
end

return range

0 comments on commit af1efe6

Please sign in to comment.