From d8b5599961e75020b6963ccef7dc494567ae0198 Mon Sep 17 00:00:00 2001 From: KemoNine Date: Sat, 23 Apr 2022 10:21:53 -0400 Subject: [PATCH] add white space highlighting and toggle at C-c w (similar to truncate lines --- common/_global.el | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/common/_global.el b/common/_global.el index 6fd2090..e970bd2 100644 --- a/common/_global.el +++ b/common/_global.el @@ -153,6 +153,13 @@ (global-set-key (kbd "C-c u") 'toggle-truncate-lines) (global-set-key (kbd "") 'delete-frame) (global-set-key (kbd "C-x C-z") nil) +(global-set-key (kbd "C-c w") + (lambda () + (interactive) + (whitespace-mode) + (whitespace-newline-mode) + ) +) ;; Lookup the current symbol at point. C-c C-d is a common keybinding ;; for this in lisp modes. @@ -220,6 +227,22 @@ (display-line-numbers-mode))) (global-display-line-numbers-mode) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; whitespace +(progn + ;; Make whitespace-mode with very basic background coloring for whitespaces. + ;; http://xahlee.info/emacs/emacs/whitespace-mode.html + (setq whitespace-style (quote (face spaces tabs newline space-mark tab-mark newline-mark ))) + + ;; Make whitespace-mode and whitespace-newline-mode use “¶” for end of line char and “▷” for tab. + (setq whitespace-display-mappings + ;; all numbers are unicode codepoint in decimal. e.g. (insert-char 182 1) + '( + (space-mark 32 [183] [46]) ; SPACE 32 「 」, 183 MIDDLE DOT 「·」, 46 FULL STOP 「.」 + (newline-mark 10 [8629 10]) ; LINE FEED, + (tab-mark 9 [8594 9] [92 9]) ; tab + ))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; modus-themes setup and enable (use-package modus-themes