0

Is there a way to put the comment character at the very beginning of the line, before any spaces, e.g., instead of having comments inserted like this

// if (b != 0)
   // if (a > b) 
      // cout << a << endl;

it should be like this

// if (b != 0)
//    if (a > b) 
//       cout << a << endl;

The only things I see in the doc are NERDSpaceDelims and NERDRemoveExtraSpaces, which I've tried toggling and don't seem to help this issue.

alaferg
  • 233
  • 2
  • 10
  • You might want to consider switching to [tcomment](https://github.com/tomtom/tcomment_vim) which does this by default. – Zach Jan 26 '16 at 01:50
  • @MateuszPiotrowski Agreed and I'll mark it as such, but not sure why you gave the same answer found there before you pointed this out... – alaferg Feb 01 '16 at 15:19
  • @alaferg Well, I've not tried cl before answering. I thought that the issue is much more complex. After somedays I did more research and realised that it this question is in fact a duplicate. One way or another, I've got no idea what might be wrong with your Vim configuration ... – Mateusz Piotrowski Feb 01 '16 at 15:34
  • @MateuszPiotrowski Well thanks anyway for the help. I agree that cl should work, so I guess I'll just live without it for now. – alaferg Feb 01 '16 at 19:06
  • @alaferg You can try to reinstall your Vim and NERDcommenter. Or try to run NERDcommenter without your standard .vimrc file (I think that `-u` flag can load an alternative vimrc file). You can also try to look at your Vim version using `:version`. Maybe there is a some component missing? – Mateusz Piotrowski Feb 01 '16 at 19:41

1 Answers1

1

If you would like to use vanilla vim, Here we go

Select the block using C-v, followed by any navigation key, in your case j. Then I. This will take you insert mode.

Now we can use any key to insert, for your particular example, \\. Finalize it by Esc.

We should have commented block now.

dlmeetei
  • 9,905
  • 3
  • 31
  • 38