Switch to nlinum from linum. Avoids linum deprecated message.

This commit is contained in:
MitchMarq42 2022-11-30 12:27:13 -09:00
parent 0709c89af9
commit 2648f8384f

View File

@ -307,23 +307,37 @@ targets."
:after (embark consult)) :after (embark consult))
;; SORTA WORKING: Relative line numbers with stuff ;; SORTA WORKING: Relative line numbers with stuff
;; (use-package nlinum-relative (use-package nlinum-relative
;; :custom :custom
;; (nlinum-format "%s ") (nlinum-relative-redisplay-delay 0)
;; (nlinum-relative-redisplay-delay 0)) :hook (prog-mode . nlinum-relative-mode)
(use-package linum-relative
:straight (:host nil
:type git
:repo
"https://git.mitchmarq42.xyz/mitch/linum-relative-justify.el")
:diminish
:custom (linum-relative-current-symbol "")
:init :init
(require 'cl-lib) (defun mitch/nlinum-buffer-setup ()
(require 'linum-relative) (setq nlinum-format-function
(add-hook 'prog-mode-hook #'display-line-numbers-equalize) (lambda (line width)
(add-hook 'prog-mode-hook #'linum-relative-mode) (let* ((line-display (abs (- line nlinum-relative--current-line)))
(add-hook 'minibuffer-exit-hook #'linum-relative-on)) (is-current-line? (eq line-display 0))
(line-display (if is-current-line?
nlinum-relative--current-line
(+ nlinum-relative-offset line-display)))
(numwidth (length (number-to-string line-display)))
(spaces (make-string (- width numwidth) ?\ ))
(nlinum-format (if is-current-line?
(format "%%d%s" spaces)
(format "%s%%d" spaces)))
(str (if (and (not (string-equal
nlinum-relative-current-symbol ""))
is-current-line?)
nlinum-relative-current-symbol
(format nlinum-format line-display))))
(if is-current-line?
(put-text-property
0 width 'face 'nlinum-relative-current-face str)
(put-text-property 0 width 'face 'linum str))
str)))
(setq-local nlinum--width (length (number-to-string
(line-number-at-pos (point-max))))))
(add-hook 'prog-mode-hook #'mitch/nlinum-buffer-setup))
;; broken terminal that doesn't compile but at least it's fast when it does ;; broken terminal that doesn't compile but at least it's fast when it does
(use-package vterm (use-package vterm