Remove linum-relative. We are not bothering with it no more.

This commit is contained in:
MitchMarq42 2022-08-08 06:35:30 -08:00
parent fbc61eaed9
commit 7bb46b66db

View File

@ -235,53 +235,54 @@ targets."
:after (embark consult)) :after (embark consult))
;; SORTA WORKING: Relative line numbers with stuff ;; SORTA WORKING: Relative line numbers with stuff
(use-package linum-relative ; (use-package linum-relative
:diminish ; :diminish
:init ; :init
(require 'cl-lib) ; (require 'cl-lib)
(require 'linum-relative) ; (require 'linum-relative)
(setq linum-relative-current-symbol "") ; (setq linum-relative-current-symbol "")
(defun mitch/get-total-width () ; (defun mitch/get-total-width ()
"set up linum relative variables per buffer." ; "set up linum relative variables per buffer."
(let ((total-lines (count-lines (point-min) (point-max)))) ; (let ((total-lines (count-lines (point-min) (point-max))))
(setq-local total-width (ceiling (log total-lines 10))))) ; (setq-local total-width (ceiling (log total-lines 10)))))
;; (defvar total-width 4) ; ;; (defvar total-width 4)
(defun mitch/symbol-width (symbol) ; (defun mitch/symbol-width (symbol)
(+ 1 (floor (log symbol 10)))) ; (+ 1 (floor (log symbol 10))))
(defun mitch/linum-get-left-pad (symbol) ; (defun mitch/linum-get-left-pad (symbol)
"Get the number of spaces to add before the current relative line number." ; "Get the number of spaces to add before the current relative line number."
(let* ((symbol-width (mitch/symbol-width line-number))) ; (let* ((symbol-width (mitch/symbol-width line-number)))
(- (mitch/get-total-width) symbol-width))) ; (- (mitch/get-total-width) symbol-width)))
(defun mitch/right-pad (line-number) ; (defun mitch/right-pad (line-number)
"Pad the line number to the right." ; "Pad the line number to the right."
(let* ((spacing (- (mitch/get-total-width) (mitch/symbol-width line-number))) ; (let* ((spacing (- (mitch/get-total-width) (mitch/symbol-width line-number)))
(spacer (make-string spacing (string-to-char " ")))) ; (spacer (make-string spacing (string-to-char " "))))
(format (concat "%s" spacer) line-number))) ; (format (concat "%s" spacer) line-number)))
(defun mitch/left-pad (line-number) ; (defun mitch/left-pad (line-number)
"Pad the line number to the left." ; "Pad the line number to the left."
(let ((spacing ; (let ((spacing
(make-string (mitch/linum-get-left-pad line-number) ; (make-string (mitch/linum-get-left-pad line-number)
(string-to-char " ")))) ; (string-to-char " "))))
(format (concat spacing "%s") line-number))) ; (format (concat spacing "%s") line-number)))
(defun linum-relative (line-number) ; (defun linum-relative (line-number)
(let* ((diff1 (abs (- line-number linum-relative-last-pos))) ; (let* ((diff1 (abs (- line-number linum-relative-last-pos)))
(diff (if (cl-minusp diff1) ; (diff (if (cl-minusp diff1)
diff1 ; diff1
(+ diff1 linum-relative-plusp-offset))) ; (+ diff1 linum-relative-plusp-offset)))
(current-p (= diff linum-relative-plusp-offset)) ; (current-p (= diff linum-relative-plusp-offset))
(current-symbol (if (and linum-relative-current-symbol current-p) ; (current-symbol (if (and linum-relative-current-symbol current-p)
(if (string= "" linum-relative-current-symbol) ; (if (string= "" linum-relative-current-symbol)
(mitch/right-pad line-number) ; (mitch/right-pad line-number)
linum-relative-current-symbol) ; linum-relative-current-symbol)
(mitch/left-pad diff))) ; (mitch/left-pad diff)))
(face (if current-p 'linum-relative-current-face 'linum))) ; (face (if current-p 'linum-relative-current-face 'linum)))
(propertize (format linum-relative-format current-symbol) 'face face))) ; (propertize (format linum-relative-format current-symbol) 'face face)))
(linum-relative-global-mode 1) ; (linum-relative-global-mode 1)
;; (mitch/linum-rel-setup) ; ;; (mitch/linum-rel-setup)
; (linum-relative 282) ; ; (linum-relative 282)
:custom ; :custom
(linum-relative-current-symbol "") ; (linum-relative-current-symbol "")
) ; )
(setq display-line-numbers-mode 'relative)
;; 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