mirror of
https://github.com/preservim/nerdcommenter.git
synced 2025-11-11 11:13:47 -05:00
Add config to allow commenting empty lines
This commit is contained in:
@@ -51,6 +51,7 @@ let s:lenSpaceStr = strlen(s:spaceStr)
|
|||||||
call s:InitVariable("g:NERDAllowAnyVisualDelims", 1)
|
call s:InitVariable("g:NERDAllowAnyVisualDelims", 1)
|
||||||
call s:InitVariable("g:NERDBlockComIgnoreEmpty", 0)
|
call s:InitVariable("g:NERDBlockComIgnoreEmpty", 0)
|
||||||
call s:InitVariable("g:NERDCommentWholeLinesInVMode", 0)
|
call s:InitVariable("g:NERDCommentWholeLinesInVMode", 0)
|
||||||
|
call s:InitVariable("g:NERDCommentEmptyLines", 0)
|
||||||
call s:InitVariable("g:NERDCompactSexyComs", 0)
|
call s:InitVariable("g:NERDCompactSexyComs", 0)
|
||||||
call s:InitVariable("g:NERDCreateDefaultMappings", 1)
|
call s:InitVariable("g:NERDCreateDefaultMappings", 1)
|
||||||
call s:InitVariable("g:NERDDefaultNesting", 1)
|
call s:InitVariable("g:NERDDefaultNesting", 1)
|
||||||
@@ -1571,8 +1572,9 @@ endfunction
|
|||||||
function s:CanCommentLine(forceNested, lineNum)
|
function s:CanCommentLine(forceNested, lineNum)
|
||||||
let theLine = getline(a:lineNum)
|
let theLine = getline(a:lineNum)
|
||||||
|
|
||||||
" make sure we don't comment lines that are just spaces or tabs or empty.
|
" make sure we don't comment lines that are just spaces or tabs or empty,
|
||||||
if theLine =~ "^[ \t]*$"
|
" unless configured otherwise
|
||||||
|
if g:NERDCommentEmptyLines == 0 && theLine =~ "^[ \t]*$"
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user