can enable TrimTrailingWhitespace when comment

This commit is contained in:
kaidiren
2016-08-31 14:32:26 +08:00
parent c3d6a2069b
commit 45689b2356

View File

@@ -746,6 +746,10 @@ function s:CommentBlock(top, bottom, lSide, rSide, forceNested )
let theLine = s:ConvertLeadingSpacesToTabs(theLine) let theLine = s:ConvertLeadingSpacesToTabs(theLine)
endif endif
if g:NERDTrimTrailingWhitespace == 1
let theLine = s:TrimTrailingWhitespace(theLine)
endif
call setline(currentLine, theLine) call setline(currentLine, theLine)
endif endif
@@ -816,6 +820,10 @@ function s:CommentLines(forceNested, align, firstLine, lastLine)
let theLine = s:ConvertLeadingSpacesToTabs(theLine) let theLine = s:ConvertLeadingSpacesToTabs(theLine)
endif endif
if g:NERDTrimTrailingWhitespace == 1
let theLine = s:TrimTrailingWhitespace(theLine)
endif
" we are done with this line " we are done with this line
call setline(currentLine, theLine) call setline(currentLine, theLine)
let currentLine = currentLine + 1 let currentLine = currentLine + 1
@@ -876,6 +884,11 @@ function s:CommentLinesMinimal(firstLine, lastLine)
if lineHasLeadingTabs if lineHasLeadingTabs
let theLine = s:ConvertLeadingSpacesToTabs(theLine) let theLine = s:ConvertLeadingSpacesToTabs(theLine)
endif endif
if g:NERDTrimTrailingWhitespace == 1
let theLine = s:TrimTrailingWhitespace(theLine)
endif
call setline(a:lastLine, theLine) call setline(a:lastLine, theLine)
endfunction endfunction
@@ -995,6 +1008,9 @@ function s:CommentLinesSexy(topline, bottomline)
let theLine = s:ConvertLeadingSpacesToTabs(theLine) let theLine = s:ConvertLeadingSpacesToTabs(theLine)
endif endif
if g:NERDTrimTrailingWhitespace == 1
let theLine = s:TrimTrailingWhitespace(theLine)
endif
" set the line and move onto the next one " set the line and move onto the next one
call setline(currentLine, theLine) call setline(currentLine, theLine)
@@ -1049,6 +1065,10 @@ function s:CommentLinesToggle(forceNested, firstLine, lastLine)
let theLine = s:ConvertLeadingSpacesToTabs(theLine) let theLine = s:ConvertLeadingSpacesToTabs(theLine)
endif endif
if g:NERDTrimTrailingWhitespace == 1
let theLine = s:TrimTrailingWhitespace(theLine)
endif
" we are done with this line " we are done with this line
call setline(currentLine, theLine) call setline(currentLine, theLine)
let currentLine = currentLine + 1 let currentLine = currentLine + 1