vimnerdcommenter

How to make use nerdcommenter to give extra space after #


I am a vim user and has nerdcommenter plugin, the problem is when I use <leader>c<space> to comment out code (also block of code), it prefix # right in front of the code, but pep8 style checker is complaining that I should have a space after the #

eg.

#string = 'abc'

but I want it to comment to:

# string = 'abc'

Solution

  • I found that adding the following to my .vimrc was helpful.

    let NERDSpaceDelims=1
    

    This adds the desired extra space for all languages (see "NERDSpaceDelims" at https://github.com/scrooloose/nerdcommenter/blob/master/doc/NERD_commenter.txt)