Make g:NERDToggleCheckAllLines not check blank/whitespace-only lines (#355)

This commit is contained in:
Lane 2019-04-17 14:49:38 +08:00 committed by Caleb Maclennan
parent f46226bcd6
commit 67950d4b5d

View File

@ -1271,8 +1271,8 @@ function! NERDComment(mode, type) range
let l:commentAllLines = 0 let l:commentAllLines = 0
for i in range(firstLine, lastLine) for i in range(firstLine, lastLine)
let theLine = getline(i) let theLine = getline(i)
" if have one line no comment, then comment all lines " if have one line no comment(not include blank/whitespace-only lines), then comment all lines
if !s:IsInSexyComment(firstLine) && !s:IsCommentedFromStartOfLine(s:Left(), theLine) && !s:IsCommentedFromStartOfLine(s:Left({'alt': 1}), theLine) if theLine =~ '[^ \t]\+' && !s:IsInSexyComment(firstLine) && !s:IsCommentedFromStartOfLine(s:Left(), theLine) && !s:IsCommentedFromStartOfLine(s:Left({'alt': 1}), theLine)
let l:commentAllLines = 1 let l:commentAllLines = 1
break break
else else