diff --git a/lua/strings/repeat/methods.lua b/lua/strings/repeat/methods.lua index a758aa7..25e4d02 100644 --- a/lua/strings/repeat/methods.lua +++ b/lua/strings/repeat/methods.lua @@ -198,7 +198,13 @@ function M.lsp_rename(case_method) M.state.change_type = constants.change_type.LSP_RENAME vim.o.operatorfunc = "v:lua.require'" .. constants.namespace .. "'.operator_callback" - vim.api.nvim_feedkeys("g@iw", "i", false) + + local mode = vim.api.nvim_get_mode().mode + if mode == "v" or mode == "V" or mode == "\22" then + vim.api.nvim_feedkeys("g@", "i", false) + else + vim.api.nvim_feedkeys("g@iw", "i", false) + end end function M.current_word(case_method) @@ -207,7 +213,13 @@ function M.current_word(case_method) M.state.change_type = constants.change_type.CURRENT_WORD vim.o.operatorfunc = "v:lua.require'" .. constants.namespace .. "'.operator_callback" - vim.api.nvim_feedkeys("g@aw", "i", false) + + local mode = vim.api.nvim_get_mode().mode + if mode == "v" or mode == "V" or mode == "\22" then + vim.api.nvim_feedkeys("g@", "i", false) + else + vim.api.nvim_feedkeys("g@aw", "i", false) + end end function M.quick_replace(case_method)