nvim-comment
nvim-comment copied to clipboard
line_mapping and operator_mapping with the same key mapping
I tried to assign the same mapping to line_mapping and operator_mapping, like with vim-commentary, but unfortunately this doesn't work:
require('nvim_comment').setup({
-- Should key mappings be created
create_mappings = true,
-- Normal mode mapping left hand side
line_mapping = '<leader>c',
-- Visual/Operator mapping left hand side
operator_mapping = '<leader>c'
})
Am I missing something or is this (currently) not possible with nvim-comment out of the box?
I encountered the same issue. A workaround:
vim.api.nvim_set_keymap('n', '<leader>c', ':CommentToggle<CR>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('v', '<leader>c', ":'<,'>CommentToggle<CR>", {noremap = true, silent = true})
Closing as this is not supported, the line_mapping being a shortcut for the operator_mapping against a line.