nerdcommenter icon indicating copy to clipboard operation
nerdcommenter copied to clipboard

Wrong indentation when inverting comment

Open dajuno opened this issue 7 years ago • 5 comments

Hi, I happen to use the <Leader>ci command a lot for situations like the following python example:

# some_dict = {
#    'key1': 0,
# }
some_dict = {
    'key1': 1,
}

When I use Invert Comment on that code, I get

some_dict = {
   'key1': 0,
}
# some_dict = {
    # 'key1': 1,
# }

But I would expect the # to be all aligned at the beginning of the line (as is done when I use <Leader>cc on the code).

Thanks for your help!

dajuno avatar May 09 '18 08:05 dajuno

Try adding this to your vim configuration after instantiating the plugin:

let g:NERDDefaultAlign = 'start'

alerque avatar Jun 19 '18 11:06 alerque

@alerque I have the same issue. It seems like NERDComToggleComment does not respect the alignment setting specified in g:NERDDefaultAlign where as NERDComComment does.

Same issue as mentioned here https://github.com/scrooloose/nerdcommenter/issues/128

Is g:NERDDefaultAlign supposed to change the alignment for toggling comments? As it doesn't seem to work.

s-taylor avatar Aug 27 '18 01:08 s-taylor

Also observed here; I use let g:NERDDefaultAlign = 'left', which works fine when commenting a block of lines using NERDCommenterToggle, but if NERDCommenterInvert is used instead, the left indent is not respected.

swertz avatar Oct 22 '19 14:10 swertz

Is this going to be fixed?

Konstantin-Glukhov avatar Jun 30 '20 05:06 Konstantin-Glukhov

It will get fixed when somebody fixes it. This is an open source project and reliant on people that use it to fixi things or add features and submit their work for others to benefit from. I personally have limited time to develop this right now, but I've been staying on top of Pull Request submissions. Anybody should feel free to tackle this issue knowing their work will benefit others.

alerque avatar Jun 30 '20 09:06 alerque