Move whitespace config to core-ui
Introduces new doom|show-whitespace-maybe hook to replace doom|editorconfig-whitespace-mode-maybe
This commit is contained in:
parent
317b556bde
commit
67f9aa1ffe
2 changed files with 26 additions and 10 deletions
|
@ -36,16 +36,7 @@ modes are active and the buffer is read-only.")
|
|||
tabify-regexp "^\t* [ \t]+" ; for :retab
|
||||
;; Wrapping
|
||||
truncate-lines t
|
||||
truncate-partial-width-windows 50
|
||||
;; whitespace-mode
|
||||
whitespace-line-column nil
|
||||
whitespace-style
|
||||
'(face indentation tabs tab-mark spaces space-mark newline newline-mark
|
||||
trailing lines-tail)
|
||||
whitespace-display-mappings
|
||||
'((tab-mark ?\t [?› ?\t])
|
||||
(newline-mark ?\n [?¬ ?\n])
|
||||
(space-mark ?\ [?·] [?.])))
|
||||
truncate-partial-width-windows 50)
|
||||
|
||||
;; ediff
|
||||
(setq ediff-diff-options "-w"
|
||||
|
|
|
@ -279,6 +279,31 @@ DEFAULT is non-nil, set the default mode-line for all buffers."
|
|||
(remove-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function))
|
||||
(add-hook 'server-visit-hook 'server-remove-kill-buffer-hook)
|
||||
|
||||
;; whitespace-mode settings
|
||||
(setq whitespace-line-column nil
|
||||
whitespace-style
|
||||
'(face indentation tabs tab-mark spaces space-mark newline newline-mark
|
||||
trailing lines-tail)
|
||||
whitespace-display-mappings
|
||||
'((tab-mark ?\t [?› ?\t])
|
||||
(newline-mark ?\n [?¬ ?\n])
|
||||
(space-mark ?\ [?·] [?.])))
|
||||
|
||||
(defun doom|show-whitespace-maybe ()
|
||||
"Show whitespace-mode when file has an `indent-tabs-mode' that is different
|
||||
from the default."
|
||||
(unless (eq indent-tabs-mode (default-value 'indent-tabs-mode))
|
||||
(require 'whitespace)
|
||||
(set (make-local-variable 'whitespace-style)
|
||||
(if (or (bound-and-true-p whitespace-mode)
|
||||
(bound-and-true-p whitespace-newline-mode))
|
||||
(cl-union (if indent-tabs-mode '(tabs tab-mark) '(spaces space-mark))
|
||||
whitespace-style)
|
||||
`(face ,@(if indent-tabs-mode '(tabs tab-mark) '(spaces space-mark))
|
||||
trailing-lines tail)))
|
||||
(whitespace-mode +1)))
|
||||
(add-hook 'after-change-major-mode-hook #'doom|show-whitespace-maybe)
|
||||
|
||||
|
||||
;;
|
||||
;; Custom hooks
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue