Created
September 15, 2010 20:24
-
-
Save bronson/581417 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
My attempt (bad): | |
function s:FixWhitespace() range | |
for lineno in range(a:firstline, a:lastline) | |
call setline(lineno, substitute(getline(lineno), '\s\+$', '', '')) | |
endfor | |
endfunction | |
" Run :FixWhitespace to remove end of line white space. | |
command! -range=% FixWhitespace silent! <line1>,<line2>call <SID>FixWhitespace | |
Original command (works): | |
command! -range=% FixWhitespace silent! let savesearch = @/ | keepjumps <line1>,<line2>substitute/\s\+$// | let @/ = savesearch | unlet savesearch | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment