mirror of
https://github.com/preservim/nerdcommenter.git
synced 2025-11-08 09:53:47 -05:00
can enable TrimTrailingWhitespace when comment
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user