Hot tip for vim users: highlight spaces at end of lines

Daniel Robertson danlrobertson89 at
Thu Dec 31 09:48:08 PST 2015

> You could also run that :substitute on :w and never have to worry about
> trailing whitespace ever again :)
> autocmd BufWritePre * :%s/\s\+$//e

Great tip! Just remember if you place a `autocmd` in your vimrc to place
it in a `augroup` and run `autocmd!`. Otherwise vim will create multiple
`autocmd`s for this each time vimrc is sourced. If I'm correct something
like the following will avoid that.


augroup trailing_whitespace
    autocmd BufWritePre * :%s/\s\+$//e
augroup END

Also for non-vim users, the git book has an incredible section on
configuring git to help with whitespace issues.

- Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <>

More information about the LibreOffice mailing list