featurep! will be renamed modulep! in the future, so it's been deprecated. They have identical interfaces, and can be replaced without issue. featurep! was never quite the right name for this macro. It implied that it had some connection to featurep, which it doesn't (only that it was similar in purpose; still, Doom modules are not features). To undo such implications and be consistent with its namespace (and since we're heading into a storm of breaking changes with the v3 release anyway), now was the best opportunity to begin the transition.
80 lines
3 KiB
EmacsLisp
80 lines
3 KiB
EmacsLisp
;;; ui/modeline/config.el -*- lexical-binding: t; -*-
|
|
|
|
(when (modulep! +light)
|
|
(load! "+light"))
|
|
|
|
|
|
(use-package! doom-modeline
|
|
:unless (modulep! +light)
|
|
:hook (after-init . doom-modeline-mode)
|
|
:hook (doom-modeline-mode . size-indication-mode) ; filesize in modeline
|
|
:hook (doom-modeline-mode . column-number-mode) ; cursor column in modeline
|
|
:init
|
|
(unless after-init-time
|
|
;; prevent flash of unstyled modeline at startup
|
|
(setq-default mode-line-format nil))
|
|
;; We display project info in the modeline ourselves
|
|
(setq projectile-dynamic-mode-line nil)
|
|
;; Set these early so they don't trigger variable watchers
|
|
(setq doom-modeline-bar-width 3
|
|
doom-modeline-github nil
|
|
doom-modeline-mu4e nil
|
|
doom-modeline-persp-name nil
|
|
doom-modeline-minor-modes nil
|
|
doom-modeline-major-mode-icon nil
|
|
doom-modeline-buffer-file-name-style 'relative-from-project
|
|
;; Only show file encoding if it's non-UTF-8 and different line endings
|
|
;; than the current OSes preference
|
|
doom-modeline-buffer-encoding 'nondefault
|
|
doom-modeline-default-eol-type
|
|
(cond (IS-MAC 2)
|
|
(IS-WINDOWS 1)
|
|
(0)))
|
|
|
|
;; Fix modeline icons in daemon-spawned graphical frames. We have our own
|
|
;; mechanism for disabling all-the-icons, so we don't need doom-modeline to do
|
|
;; it for us. However, this may cause unwanted padding in the modeline in
|
|
;; daemon-spawned terminal frames. If it bothers you, you may prefer
|
|
;; `doom-modeline-icon' set to `nil'.
|
|
(when (daemonp)
|
|
(setq doom-modeline-icon t))
|
|
:config
|
|
;; HACK Fix #4102 due to empty all-the-icons return value (caused by
|
|
;; `doom--disable-all-the-icons-in-tty-a' advice) in tty daemon frames.
|
|
(defadvice! +modeline-disable-icon-in-daemon-a (fn &rest args)
|
|
:around #'doom-modeline-propertize-icon
|
|
(when (display-graphic-p)
|
|
(apply fn args)))
|
|
|
|
;; Fix an issue where these two variables aren't defined in TTY Emacs on MacOS
|
|
(defvar mouse-wheel-down-event nil)
|
|
(defvar mouse-wheel-up-event nil)
|
|
|
|
(add-hook 'after-setting-font-hook #'+modeline-resize-for-font-h)
|
|
(add-hook 'doom-load-theme-hook #'doom-modeline-refresh-bars)
|
|
|
|
(add-hook '+doom-dashboard-mode-hook #'doom-modeline-set-project-modeline)
|
|
|
|
(add-hook! 'magit-mode-hook
|
|
(defun +modeline-hide-in-non-status-buffer-h ()
|
|
"Show minimal modeline in magit-status buffer, no modeline elsewhere."
|
|
(if (eq major-mode 'magit-status-mode)
|
|
(doom-modeline-set-vcs-modeline)
|
|
(hide-mode-line-mode))))
|
|
|
|
;; Some functions modify the buffer, causing the modeline to show a false
|
|
;; modified state, so force them to behave.
|
|
(defadvice! +modeline--inhibit-modification-hooks-a (fn &rest args)
|
|
:around #'ws-butler-after-save
|
|
(with-silent-modifications (apply fn args)))
|
|
|
|
|
|
;;
|
|
;;; Extensions
|
|
(use-package! anzu
|
|
:after-call isearch-mode)
|
|
|
|
(use-package! evil-anzu
|
|
:when (modulep! :editor evil)
|
|
:after-call evil-ex-start-search evil-ex-start-word-search evil-ex-search-activate-highlight
|
|
:config (global-anzu-mode +1)))
|