Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8090111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:36:42+00:00 2026-06-05T19:36:42+00:00

In Vim, when I comment a multi-line visual selection using NERDCommenter, the blank lines

  • 0

In Vim, when I comment a multi-line visual selection using NERDCommenter, the blank lines in the selection are not commented. In the example below, I select all 5 lines and type “\cl” (for NERDCommenterAlignLeft), but the 3rd line, which is blank, is not commented.

Before:

" Normalize Markdown : Remove Trailing # From Headers
nnoremap <Leader>qq :%s/ \+#\+ *$//gc<CR>

" Normalize Markdown : Remove Trailing Whitespace
nnoremap <Leader>qw :%s/\s\+$//gc<CR>

After:

" " Normalize Markdown : Remove Trailing # From Headers
" nnoremap <Leader>qq :%s/ \+#\+ *$//gc<CR>

" " Normalize Markdown : Remove Trailing Whitespace
" nnoremap <Leader>qw :%s/\s\+$//gc<CR>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T19:36:44+00:00Added an answer on June 5, 2026 at 7:36 pm

    This is how it has been implemented in NERDCommenter plugin. If you open the plugin file (NERD_commenter.vim) and look for a function named s:CanCommentLine, you will see that it has the following check:

    " make sure we don't comment lines that are just spaces or tabs or empty.
    if theLine =~ "^[ \t]*$"
        return 0
    endif
    

    So, before the plugin goes ahead to comment a line, it checks if it is an empty line. If so, the plugin does not comment it and skips to the next line.

    A quickfix would be to simply remove this part of the code from your plugin file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using c-support in Vim. One of it's features is the automatic comment expansion
It happens more often than not that I have to comment several lines at
I want to map \c to comment the current line in vim (add '//
In using vim, when I start a comment with //, immediately after I type
Whenever I want to add a comment to an indented line in vim, I
/** * Example Comment */ When I press enter after Comment Vim autoindents but
Vim is almost perfect for me. But I still want a line comment and
I'm new to using Visual Studio 2008 IDE. Switching from vim. Is there a
How do I add a comment in Vim's configuration files, like .vimrc?
Vim customization -- I have added these lines in my .vimrc inoremap /* /**/<

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.