nerdcommenter icon indicating copy to clipboard operation
nerdcommenter copied to clipboard

Wrong begin/end when commenting with visual mode Ruby code

Open novito opened this issue 8 years ago • 5 comments

Given I have the following code:

def test
  puts 'test'
end

When I place the cursor right in the d of def and I do a visual selection all the way down to end, if I try to comment it, I end up with:

=begindef test=end
  #puts 'test'
=beginend=end

If I do it with visual line I end up properly commented like:

#def test
  #puts 'test'
#end

I am not sure why is that happening and would love to contribute if you point me to where should I be looking.

novito avatar Jul 27 '17 15:07 novito

This seems similar to my report here https://github.com/scrooloose/nerdcommenter/issues/304

trak3r avatar Aug 04 '17 13:08 trak3r

I've seen this too. If you've set paste, it seems to mess with it a bit more, so set nopaste before commenting. Also, I've noticed that the most consistent way to comment is c-space. Other modes have problems.

ogreface avatar Aug 04 '17 21:08 ogreface

Hello,

Same thing for me, I found this has been introduced by commit 1b621843051b854a3fb945cd37256e977a2a3288. Before this one it was properly working.

Can someone revert this commit for the vim ruby developers using this plugin please :) ?

keysen avatar Jul 24 '18 22:07 keysen

I've merged the temporary fix, but I'm leaving this issue open because now there is no multi-line comment function at all. That should get added back in when somebody can figure out why the Ruby syntax has gremlins.

alerque avatar Jul 31 '18 17:07 alerque

Thank you @alerque and yes let's wait somebody to fix the multi-line comment with block.

keysen avatar Jul 31 '18 20:07 keysen