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

Daniel Robertson danlrobertson89 at gmail.com
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.

E.g.

augroup trailing_whitespace
    autocmd!
    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.

http://www.git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#Formatting-and-Whitespace

- Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20151231/0da9bd6a/attachment.sig>


More information about the LibreOffice mailing list