preservim / nerdcommenter

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

Provide argument for bufnr #521

Closed serpent7776 closed 1 year ago

serpent7776 commented 1 year ago

There's an error in vim 8.0:

E119: Not enough arguments for function: bufnr
E116: Invalid arguments for function getbufvar(bufnr(),'NERDCommenterFirstInit')
E15: Invalid expression: getbufvar(bufnr(),'NERDCommenterFirstInit')

In that version, bufnr requires an argument, so pass "%", which means current buffer.

serpent7776 commented 1 year ago

I checked this on vim 8.0 and 8.2 and both versions work.

Documentation says "" or "%" can be used for the current buffer on both versions. For 8.2 the first argument is optional, but for 8.0 it isn't.

I think it should be safe for newer versions, unless vim broke compatibility here. Unsure about versions older than 8.0.