Date: prev next · Thread: first prev next last
2015 Archives by date, by thread · List index



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

Attachment: signature.asc
Description: Digital signature


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.