Closed gilbh closed 1 year ago
Have you tried any of the following:
nnoremap <leader>3 <plug>NERDCommenterInvertj
nnoremap <leader>3 <plug>NERDCommenterInvert j
nnoremap <leader>3 :execute "normal \<Plug>NERDCommenterInvert"<CR>j
Off the top of my head I feel like 1 and 3 both work
I've used this way in neovim and lua (may be it will helpfull for someone)
local map = vim.api.nvim_set_keymap
function nm(key, command)
map('n', key, command, {noremap = true, silent = true})
end
function commentLineToggle()
vim.cmd('call nerdcommenter#Comment("n", "toggle")')
vim.cmd('normal j')
end
nm('<C-_>', "<cmd>lua commentLineToggle()<CR>")
Thanks @puttehi ! Actually, all the three options worked! Fantastic!
@dsyabitov , I didn't start writing in lua yet, but what you show here very clear and can serve as a sort-of a boilerplate for other stuff too. Thanks!!
Hi,
Is there a way to move down the caret after the commented section? I don't know how to add the motion 'j' at the end of the following command:
Thanks!