diff --git a/lua/nvim_comment.lua b/lua/nvim_comment.lua index 89ae04c..e43b5c2 100644 --- a/lua/nvim_comment.lua +++ b/lua/nvim_comment.lua @@ -152,7 +152,7 @@ function M.setup(user_opts) if M.config.create_mappings then local opts = {noremap = true, silent = true} - vim.api.nvim_set_keymap("n", M.config.line_mapping, ":set operatorfunc=CommentOperatorg@", opts) + vim.api.nvim_set_keymap("n", M.config.line_mapping, ":normal " .. M.config.operator_mapping .. "l", opts) vim.api.nvim_set_keymap("n", M.config.operator_mapping, ":set operatorfunc=CommentOperatorg@", opts) vim.api.nvim_set_keymap("v", M.config.operator_mapping, ":call CommentOperator(visualmode())", opts) end diff --git a/tests/comment_spec.lua b/tests/comment_spec.lua index 626d785..9084023 100644 --- a/tests/comment_spec.lua +++ b/tests/comment_spec.lua @@ -56,9 +56,9 @@ end setUpBuffer(input, "lua") -- comment - runCommandAndAssert(1, "gcl", expected) + runCommandAndAssert(1, "gcc", expected) -- uncomment - runCommandAndAssert(1, "gcl", input) + runCommandAndAssert(1, "gcc", input) -- comment, via dot runCommandAndAssert(1, ".", expected) end)