From 67950d4b5d2e78733ab085a57c897c711e5eb2dc Mon Sep 17 00:00:00 2001 From: Lane Date: Wed, 17 Apr 2019 14:49:38 +0800 Subject: [PATCH] Make g:NERDToggleCheckAllLines not check blank/whitespace-only lines (#355) --- plugin/NERD_commenter.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/NERD_commenter.vim b/plugin/NERD_commenter.vim index 60c0e31..c9e081a 100644 --- a/plugin/NERD_commenter.vim +++ b/plugin/NERD_commenter.vim @@ -1271,8 +1271,8 @@ function! NERDComment(mode, type) range let l:commentAllLines = 0 for i in range(firstLine, lastLine) let theLine = getline(i) - " if have one line no comment, then comment all lines - if !s:IsInSexyComment(firstLine) && !s:IsCommentedFromStartOfLine(s:Left(), theLine) && !s:IsCommentedFromStartOfLine(s:Left({'alt': 1}), theLine) + " if have one line no comment(not include blank/whitespace-only lines), then comment all lines + if theLine =~ '[^ \t]\+' && !s:IsInSexyComment(firstLine) && !s:IsCommentedFromStartOfLine(s:Left(), theLine) && !s:IsCommentedFromStartOfLine(s:Left({'alt': 1}), theLine) let l:commentAllLines = 1 break else