Skip to content

Instantly share code, notes, and snippets.

@nyergler
Created July 5, 2015 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nyergler/939bdcc0fc54ddceab92 to your computer and use it in GitHub Desktop.
Save nyergler/939bdcc0fc54ddceab92 to your computer and use it in GitHub Desktop.
Whitespace like a civilized person
;; whitespace mode configuration
(require 'whitespace)
; make whitespace-mode use just basic coloring
(setq whitespace-style (quote
(spaces tabs newline tab-mark newline-mark face lines-tail)))
(setq show-trailing-whitespace 't)
(global-whitespace-mode 't)
;; make whitespace-mode use “¶” for newline and “▷” for tab.
;; together with the rest of its defaults
(setq whitespace-display-mappings
'(
(space-mark 32 [183] [46]) ; normal space, ·
(space-mark 160 [164] [95])
(space-mark 2208 [2212] [95])
(space-mark 2336 [2340] [95])
(space-mark 3616 [3620] [95])
(space-mark 3872 [3876] [95])
(newline-mark 10 [182 10]) ; newlne, ¶
(tab-mark 9 [9655 9] [92 9]) ; tab, ▷
))
;; Trailing whitespace is unnecessary
(add-hook 'before-save-hook (lambda () (delete-trailing-whitespace)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment