6 ms·
Ah, aggressive trailing whitespace removal. That I can completely get behind. I've already got command-s bound to a custom macro that strips trailing whitespace
by xyzzyb 15y ago
Ah, aggressive trailing whitespace removal. That I can completely get behind. I've already got command-s bound to a custom macro that strips trailing whitespace in TextMate for myself and my co-workers; but this would be an even more inclusive solution.
- tensafefrogs 15y agoFantastic. If you use vim, you should have this in your .vimrc: " Remove any trailing whitespace that is in the file autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif
- illicium 15y agoI prefer using the vim-trailing-whitespace plugin and fixing it manually: https://github.com/bronson/vim-trailing-whitespace https://github.com/bronson/vim-trailing-whitespace
- throwaway392 15y agoOr you can use my competing plugin: https://github.com/bitc/vim-bad-whitespace https://github.com/bitc/vim-bad-whitespace which has some advantages (described in the README)
- jdwhit2 15y agoOne advantage taken from the readme: This plugin is better than using the builtin vim 'list' command because it doesn't show an annoying highlight while you are typing in insert mode at the end of a line.
- snprbob86 15y agoOr, if you prefer a more manual approach (ie. my fellow paranoid developers) simply use `list` and `listchars`: set list set listchars=trail:• In other people's code, use `set nolist` to prevent hyperventilation. In general, explore `help list`.
- phillmv 15y agoUhm. Why is this annoying, other than the fact that it shows up in your git commits?
- Mizza 15y agoIf you use Vim from the terminal to edit text (which I do), trailing whitespace shows up as big white blocks. It's slightly visually distracting, but it's really just an OCD thing.
- gbog 15y agoNo. Absence or presence of trailing whitespaces is sometime significant, such as in big ereg in re.VERBOSE mode in Python. Therefore, it must be visible, and if it is visible it must be removed when it has no use.
- yxhuvud 15y agoI prefer to have my editor strip that whenever I save a file without any manual action.
- xyzzyb 15y agoI should clarify that command-s is the save command. My macro overrides the standard behavior.