From cf4912d36c8e005b0e6b193fc698eaaf9b6cfac5 Mon Sep 17 00:00:00 2001 From: Wagner Camarao Date: Fri, 29 May 2015 15:57:02 -0700 Subject: [PATCH] Add config to allow commenting empty lines --- plugin/NERD_commenter.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugin/NERD_commenter.vim b/plugin/NERD_commenter.vim index b7ba977..862531a 100644 --- a/plugin/NERD_commenter.vim +++ b/plugin/NERD_commenter.vim @@ -51,6 +51,7 @@ let s:lenSpaceStr = strlen(s:spaceStr) call s:InitVariable("g:NERDAllowAnyVisualDelims", 1) call s:InitVariable("g:NERDBlockComIgnoreEmpty", 0) call s:InitVariable("g:NERDCommentWholeLinesInVMode", 0) +call s:InitVariable("g:NERDCommentEmptyLines", 0) call s:InitVariable("g:NERDCompactSexyComs", 0) call s:InitVariable("g:NERDCreateDefaultMappings", 1) call s:InitVariable("g:NERDDefaultNesting", 1) @@ -1571,8 +1572,9 @@ endfunction function s:CanCommentLine(forceNested, lineNum) let theLine = getline(a:lineNum) - " make sure we don't comment lines that are just spaces or tabs or empty. - if theLine =~ "^[ \t]*$" + " make sure we don't comment lines that are just spaces or tabs or empty, + " unless configured otherwise + if g:NERDCommentEmptyLines == 0 && theLine =~ "^[ \t]*$" return 0 endif