Skip to content

Commit

Permalink
Use mapmode-x in Visual mapping (#30)
Browse files Browse the repository at this point in the history
Co-authored-by: Alex Tylor <alex@tylor.co.uk>
  • Loading branch information
danbyl and terrortylor authored Mar 15, 2022
1 parent 3dd3df6 commit 0cd8228
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lua/nvim_comment.lua
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,15 @@ function M.setup(user_opts)
let @@ = reg_save
endfunction
]]

vim.api.nvim_call_function("execute", { vim_func })
vim.api.nvim_command("command! -range CommentToggle lua require('nvim_comment').comment_toggle(<line1>, <line2>)")

if M.config.create_mappings then
local opts = { noremap = true, silent = true }
api.nvim_set_keymap("n", M.config.line_mapping, "<Cmd>set operatorfunc=CommentOperator<CR>g@l", opts)
api.nvim_set_keymap("n", M.config.operator_mapping, "<Cmd>set operatorfunc=CommentOperator<CR>g@", opts)
api.nvim_set_keymap("v", M.config.operator_mapping, ":<C-u>call CommentOperator(visualmode())<CR>", opts)
api.nvim_set_keymap("x", M.config.operator_mapping, ":<C-u>call CommentOperator(visualmode())<CR>", opts)
api.nvim_set_keymap(
"x",
M.config.comment_chunk_text_object,
Expand Down

0 comments on commit 0cd8228

Please sign in to comment.