via Jim Meyering via coreutils list
Some configs for vim and emacs to show trailing whitespace and other whitespace anomalies.
vim config
let c_space_errors=1
highlight RedundantSpaces ctermbg=red guibg=red
match RedundantSpaces /\s\+$\| \+\ze\t/
Emacs needs the Whitespace mode from http://www.emacswiki.org/emacs/WhiteSpace
The default config is a bit overboard for me, so I use something more like:
;http://www.emacswiki.org/emacs/WhiteSpace
(require 'whitespace)
(autoload 'global-whitespace-mode "whitespace" "Toggle whitespace visualization." t)
(autoload 'global-whitespace-toggle-options "whitespace" "Toggle local `whitespace-mode' options." t)
;turn on the more or less git diff --color whitespace highlighting
(setq whitespace-space whitespace-style (quote (face tabs trailing space-before-tab newline empty space-after-tab indentation)))