4 ms·
Here's a function I wrote to get rid of trailing white space: fun! s:RemoveWhitespace() if &bin | return | endif if search('\s\+$', 'n') le
by meese_ 17y ago
Here's a function I wrote to get rid of trailing white space:
fun! s:RemoveWhitespace()
if &bin | return | endif
if search('\s\+$', 'n')
let line = line('.')
let col = col('.')
sil %s/\s\+$//ge
call cursor(line, col)
echo 'Removed trailing whitespace.'
else
echo 'No trailing whitespace found.'
endif
endf
You can map it with:
nn <silent> ,R :cal<SID>RemoveWhitespace()<cr>