preservim / nerdcommenter

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

Do not add extra space after left delim in empty line #494

Closed Masquue closed 2 years ago

Masquue commented 2 years ago

s:CommentLines currently add an extra space after left delim regardless if the line is empty.

This causes the following code (cursor position represented as |):

{
|
}

if using command V\cc, to be formatted as (space represented as _):

{
//_
}

This patch removes this extra trailing space on empty lines in s:CommentLines.

Masquue commented 2 years ago

Closing as there is already an option 'NERDTrimTrailingWhitespace' which does this.

But the doc is in correct as it says

'NERDTrimTrailingWhitespace' Specifies if trailing whitespace should be deleted when uncommenting

Trailing whitespaces are also trimmed when commenting.