Switch to nlinum from linum. Avoids linum deprecated
message.
This commit is contained in:
parent
0709c89af9
commit
2648f8384f
@ -307,23 +307,37 @@ targets."
|
||||
:after (embark consult))
|
||||
|
||||
;; SORTA WORKING: Relative line numbers with stuff
|
||||
;; (use-package nlinum-relative
|
||||
;; :custom
|
||||
;; (nlinum-format "%s ")
|
||||
;; (nlinum-relative-redisplay-delay 0))
|
||||
(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 "")
|
||||
(use-package nlinum-relative
|
||||
:custom
|
||||
(nlinum-relative-redisplay-delay 0)
|
||||
:hook (prog-mode . nlinum-relative-mode)
|
||||
:init
|
||||
(require 'cl-lib)
|
||||
(require 'linum-relative)
|
||||
(add-hook 'prog-mode-hook #'display-line-numbers-equalize)
|
||||
(add-hook 'prog-mode-hook #'linum-relative-mode)
|
||||
(add-hook 'minibuffer-exit-hook #'linum-relative-on))
|
||||
(defun mitch/nlinum-buffer-setup ()
|
||||
(setq nlinum-format-function
|
||||
(lambda (line width)
|
||||
(let* ((line-display (abs (- line nlinum-relative--current-line)))
|
||||
(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
|
||||
(use-package vterm
|
||||
|
Loading…
Reference in New Issue
Block a user