diff --git a/core/core-ui.el b/core/core-ui.el index dae012601..43c6935d5 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -234,47 +234,24 @@ file." (add-hook! (prog-mode text-mode) (unless (eq major-mode 'org-mode) (nlinum-mode +1))) - :config - (defun doom-nlinum-flush-window (&optional window) - (let ((window (or window (selected-window))) - (orig-win (selected-window))) - (with-selected-window window - (when nlinum-mode - (if (not (eq window orig-win)) - (nlinum--flush) - ;; done in two steps to leave current line number highlighting alone - (nlinum--region (point-min) (max 1 (1- (line-beginning-position)))) - (nlinum--region (min (point-max) (1+ (line-end-position))) (point-max))))))) - - ;; nlinum has a tendency to lose line numbers over time; a known issue. These - ;; hooks/advisors attempt to stave off these glitches. - (defun doom*nlinum-flush-all-windows (&rest _) - "Fix nlinum margins after major UI changes (like a change of font)." - (mapc #'doom-nlinum-flush-window (doom-visible-windows)) - nil) - (advice-add #'set-frame-font :after #'doom*nlinum-flush-all-windows) - - (defun doom*nlinum-flush (&optional _ norecord) - ;; norecord check is necessary to prevent infinite recursion in - ;; `select-window' - (when (not norecord) (doom-nlinum-flush-window))) - (advice-add #'select-window :before #'doom*nlinum-flush) - (advice-add #'select-window :after #'doom*nlinum-flush) - (add-hook '+evil-esc-hook #'doom*nlinum-flush-all-windows t) - (add-hook 'focus-in-hook #'doom*nlinum-flush-all-windows) - (add-hook 'focus-out-hook #'doom*nlinum-flush-all-windows) - - ;; - (after! web-mode - (advice-add #'web-mode-fold-or-unfold :after #'doom*nlinum-flush)) - ;; Optimization: calculate line number column width beforehand (add-hook! nlinum-mode (setq nlinum--width (length (save-excursion (goto-char (point-max)) (format-mode-line "%l")))))) +;; Highlight current line, and other nlinum tweaks/fixes +(def-package! nlinum-hl + :after nlinum + :init (add-hook 'nlinum-mode-hook #'nlinum-hl-mode) + :config + ;; nlinum has a tendency to lose line numbers over time; a known issue. These + ;; hooks/advisors attempt to stave off these glitches. + (advice-add #'select-window :before #'nlinum-hl-do-flush) + (advice-add #'select-window :after #'nlinum-hl-do-flush) + (add-hook '+evil-esc-hook #'nlinum-hl-flush-all-windows t)) + ;; Helps us distinguish stacked delimiter pairs. Especially in parentheses-drunk ;; languages like Lisp. (def-package! rainbow-delimiters diff --git a/core/packages.el b/core/packages.el index bb06a4ab3..67a29e5b1 100644 --- a/core/packages.el +++ b/core/packages.el @@ -15,6 +15,7 @@ (package! highlight-indentation) (package! highlight-numbers) (package! nlinum) +(package! nlinum-hl) (package! rainbow-delimiters) (package! vi-tilde-fringe) (package! visual-fill-column) diff --git a/modules/ui/doom/config.el b/modules/ui/doom/config.el index 957f897a1..39fb64434 100644 --- a/modules/ui/doom/config.el +++ b/modules/ui/doom/config.el @@ -30,12 +30,12 @@ ;; doom-one: gives Emacs a look inspired by Dark One in Atom. ;; -(def-package! doom-themes :demand t +(def-package! doom-themes + :load-path "~/work/plugins/emacs-doom-themes/" + :demand t :config (load-theme +doom-theme t) - ;; nlinum line highlighting - (doom-themes-nlinum-config) ;; Add file icons to doom-neotree (doom-themes-neotree-config)