     'nlinum-mode)
 
   :config
-  (defun doom/nlinum-toggle ()
+  (defun doom/toggle-line-numbers ()
     "Toggle `nlinum-mode'."
     (interactive)
-    (nlinum-mode (if (bound-and-true-p nlinum-mode) -1 +1)))
+    (nlinum-mode (if nlinum-mode -1 +1)))
 
   ;; Optimization: calculate line number column width beforehand
   (add-hook! nlinum-mode

  (add-hook! highlight-indent-guides-mode
    (if highlight-indent-guides-mode
        (progn
          (doom|highlight-indent-guides-adjust-whitespace)
          (add-hook 'after-save-hook 'doom|highlight-indent-guides-adjust-whitespace nil t))
      (remove-hook 'after-save-hook 'doom|highlight-indent-guides-adjust-whitespace t)
      (delete-trailing-whitespace)))

  ;; If all else fails, this package tries to guess the indentation, but does it
  ;; naively, so get default indentation from editorconfig instead.
  (defun doom*highlight-indentation-guess-offset (&rest _)
    (when (featurep 'editorconfig)
      (setq-local highlight-indentation-offset
                  (string-to-int (gethash 'indent_size (editorconfig-get-properties))))))
  (advice-add 'highlight-indentation-guess-offset :before 'doom*highlight-indentation-guess-offset))

;; Some modes don't adequately highlight numbers, therefore...
(package! highlight-numbers :commands highlight-numbers-mode)

;; Line highlighting (built-in)
(package! hl-line :ensure nil
  :config
  ;; stickiness doesn't play nice with emacs 25+
  (setq hl-line-sticky-flag nil
        global-hl-line-sticky-flag nil)

  ;; Remember whether hl-line was initially on or off in the current buffer
  (defvar-local doom--hl-line-mode nil)
  (defun doom|hl-line-on ()  (if doom--hl-line-mode (hl-line-mode +1)))
  (defun doom|hl-line-off () (if doom--hl-line-mode (hl-line-mode -1)))
  (add-hook! hl-line-mode (if hl-line-mode (setq doom--hl-line-mode t))))

;; A faster (or equal, in the worst case) line number plugin than `linum'. I've
;; modified it to highlight the current line, and fixed some glaring problems
;; with nlinum and frames.
(package! nlinum
  :commands nlinum-mode
  :preface (defvar nlinum-format "%4d ")

      image-animate-loop t
      indicate-buffer-boundaries nil
      indicate-empty-lines nil
      max-mini-window-height 0.3
      mode-line-default-help-echo nil  ; disable mode-line mouseovers
      redisplay-dont-pause t         ; don't pause display on input
