diff --git a/core/autoload/editor.el b/core/autoload/editor.el index 3145d811a..03c60a7e1 100644 --- a/core/autoload/editor.el +++ b/core/autoload/editor.el @@ -200,7 +200,7 @@ for function signatures or notes. Run again to clear the header line." (interactive "r") (setq header-line-format (when mark-active - (concat (propertize (format nlinum-format (line-number-at-pos beg)) + (concat (propertize (format linum-format (line-number-at-pos beg)) 'face 'font-lock-comment-face) (let ((content (buffer-substring beg end))) (setq content (replace-regexp-in-string "\n" " " content t t)) diff --git a/core/autoload/ui.el b/core/autoload/ui.el index 0738fd53b..a0b509f68 100644 --- a/core/autoload/ui.el +++ b/core/autoload/ui.el @@ -10,10 +10,10 @@ 'fullboth))) ;;;###autoload -(defun doom/toggle-line-numbers () - "Toggle `nlinum-mode'." - (interactive) - (nlinum-mode (if nlinum-mode -1 +1))) +(defun doom/toggle-line-numbers (&optional arg) + "Toggle `linum-mode'." + (interactive "P") + (linum-mode (or arg (if linum-mode -1 +1)))) ;;;###autoload (defun doom/window-zoom () diff --git a/core/core-ui.el b/core/core-ui.el index 67f3e844f..77c27ced8 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -182,36 +182,25 @@ file." ;; Line highlighting (def-package! hl-line ; built-in + :init + (add-hook! (linum-mode nlinum-mode) #'hl-line-mode) :config ;; stickiness doesn't play nice with emacs 25+ (setq hl-line-sticky-flag nil global-hl-line-sticky-flag nil)) -;; Line number column. A faster (or equivalent, in the worst case) line number -;; plugin than the built-in `linum'. -(def-package! nlinum - :commands nlinum-mode - :preface - (defvar linum-format "%3d ") - (defvar nlinum-format "%4d ") +;; Line numbers +(def-package! linum + :commands linum-mode + :preface (defvar linum-format "%4d ") :init - (add-hook! - (markdown-mode prog-mode scss-mode web-mode conf-mode groovy-mode - nxml-mode snippet-mode php-mode) - #'nlinum-mode) + (add-hook! (prog-mode text-mode) + (unless (eq major-mode 'org-mode) + (call-interactively #'linum-mode))) :config - (defun doom*nlinum-flush (&rest _) - "Fix nlinum margins after a change in font." - (dolist (buffer (doom-visible-buffers)) - (with-current-buffer buffer - (when nlinum-mode (nlinum--flush))))) - (advice-add #'set-frame-font :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")))))) + (require 'hlinum) ; highlight current line number + (hlinum-activate)) ;; Helps us distinguish stacked delimiter pairs. Especially in parentheses-drunk ;; languages like Lisp. diff --git a/core/packages.el b/core/packages.el index b0e5ee22b..976a528d2 100644 --- a/core/packages.el +++ b/core/packages.el @@ -14,7 +14,7 @@ ;; core-ui.el (package! highlight-indentation) (package! highlight-numbers) -(package! nlinum) +(package! hlinum) (package! rainbow-delimiters) (package! visual-fill-column) diff --git a/modules/app/write/autoload.el b/modules/app/write/autoload.el index 325bb612d..b132bd881 100644 --- a/modules/app/write/autoload.el +++ b/modules/app/write/autoload.el @@ -14,7 +14,7 @@ +write-mode) (setq +write--buffer-mode doom-buffer-mode)) (text-scale-set (if +write-mode 2 0)) - (nlinum-mode iarg) + (doom/toggle-line-numbers iarg) (setq-local visual-fill-column-center-text +write-mode) (visual-fill-column-mode arg) (visual-line-mode arg) diff --git a/modules/lang/web/+html.el b/modules/lang/web/+html.el index 9b9276143..dec042f42 100644 --- a/modules/lang/web/+html.el +++ b/modules/lang/web/+html.el @@ -15,9 +15,6 @@ (set! :company-backend 'web-mode '(company-web-html company-yasnippet)) (setq web-mode-enable-html-entities-fontification t) - ;; Fix blank line numbers after unfolding - (advice-add #'web-mode-fold-or-unfold :after #'nlinum--flush) - (map! :map web-mode-map (:localleader :n "rt" #'web-mode-element-rename) "M-/" #'web-mode-comment-or-uncomment diff --git a/modules/ui/doom/config.el b/modules/ui/doom/config.el index 8ded3fce5..4850a0db6 100644 --- a/modules/ui/doom/config.el +++ b/modules/ui/doom/config.el @@ -90,10 +90,7 @@ (doom-themes-neotree-config) (setq doom-neotree-enable-variable-pitch t doom-neotree-file-icons 'simple - doom-neotree-line-spacing 2) - - ;; Add line-highlighting to nlinum - (doom-themes-nlinum-config)) + doom-neotree-line-spacing 2)) ;; Flashes the line around the cursor after any motion command that might