doomemacs/modules/ui/modeline/config.el
Ellis Kenyő 9787022b83
refactor!: replace all-the-icons with nerd-icons
BREAKING CHANGE: This commit replaces all-the-icons with nerd-fonts. Any
all-the-icons-* function calls or variable references in your private
config will break and should be replaced with their nerd-icons-*
equivalent. That said, Doom will continue to install all-the-icons for
a while, so feel free to load it if you don't want to fully commit to
the change yet.

This change is happening because nerd-icon has wider support for GUI and
TUI Emacs; has a larger, more consistent selection of symbols; plus unicode
coverage.

Fix: #7368
Close: #6675
Close: #7364
2023-09-14 01:03:55 +02:00

71 lines
2.7 KiB
EmacsLisp

;;; ui/modeline/config.el -*- lexical-binding: t; -*-
(when (modulep! +light)
(load! "+light"))
(use-package! doom-modeline
:unless (modulep! +light)
:hook (doom-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
(when (>= emacs-major-version 29)
;; HACK: Emacs 29 treats `nil' for :background as invalid, and complains.
;; `doom-modeline' hasn't updated its face to address this yet.
;; REVIEW: PR this fix to doom-modeline
(defface doom-modeline-buffer-modified
'((t (:inherit (error bold) :background unspecified)))
"Face used for the \\='unsaved\\=' symbol in the mode-line."
:group 'doom-modeline-faces))
;; 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)))
:config
;; 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-to-list 'doom-modeline-mode-alist '(+doom-dashboard-mode . dashboard))
(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-modeline 'magit)
(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)))