From ecdde217c0b7c983b67cf8508333e44fd55b2740 Mon Sep 17 00:00:00 2001 From: Jorge Marin Date: Tue, 15 Nov 2016 16:20:51 +0100 Subject: [PATCH] Remove trailing whitespace for top and bottom line (#269) Fixes #268 Remove trailing whitespace for top and bottom line when uncommenting a sexy commented block. --- plugin/NERD_commenter.vim | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugin/NERD_commenter.vim b/plugin/NERD_commenter.vim index 97008a4..40e86ef 100644 --- a/plugin/NERD_commenter.vim +++ b/plugin/NERD_commenter.vim @@ -1620,6 +1620,16 @@ function s:UncommentLinesSexy(topline, bottomline) let theLine = s:SwapOuterPlaceHoldersForMultiPartDelims(theLine) call setline(bottomline, theLine) endif + + " remove trailing whitespaces for first and last line + if g:NERDTrimTrailingWhitespace == 1 + let theLine = getline(a:bottomline) + let theLine = s:TrimTrailingWhitespace(theLine) + call setline(a:bottomline, theLine) + let theLine = getline(a:topline) + let theLine = s:TrimTrailingWhitespace(theLine) + call setline(a:topline, theLine) + endif endfunction " Function: s:UncommentLineNormal(line) {{{2