preservim / nerdcommenter

Vim plugin for intensely nerdy commenting powers
Creative Commons Zero v1.0 Universal
4.97k stars 447 forks source link

Error on version 2.6.0 #490

Closed staskjs closed 2 years ago

staskjs commented 2 years ago

Recently I reinstalled vim, then Vundle automatically installed newest nerdcommenter version 2.6.0 I instantly ran into a problem trying to use leader + c + space in visual mode, I get this error: image

Everything is fine on previous version.

Tried all vim versions from 7.4 to 8.2

alerque commented 2 years ago

Your keybindings appear to be using the deprecated NerdComment() function. This has been replaced by nerdcommenter#Comment(). We put a shim in place to catch many common usages, but we were not able to cover the visual mode with more than one line selected.

In any case the fix should be to update your vimrc file with the correct nerdcommenter#Comment() function, or (NERDCommenterComment as a command).

staskjs commented 2 years ago

Apparently you are right, I do have my own keybindings, I completely forgot about them... I don't really understand how I should fix them. I have lines like this:

nxmap <leader>c<space> :call Comment('Toggle', 'x')<cr>

How it should be changed?

alerque commented 2 years ago

I'm not sure where your nxmap is coming from because neither my VIM nor NeoVIM ham that, but here are a couple starting points for you:

nmap <leader>c<space> NERDCommenterToggle
" or
nmap <leader>c<space> :call nerdcommenter#Comment('Toggle', 'x')<cr>
staskjs commented 2 years ago

That was a typo, sorry. There is nmap. It worked, but I had to change the order of arguments, so nmap <leader>c<space> :call nerdcommenter#Comment('n', 'Toggle')<cr> is apparently a way to go. Thank you!