Emacs: only toggle relative/absolute line numbers when any are shown
Alan Pearce alan@alanpearce.eu
Sun, 09 Jul 2023 12:30:17 +0200
1 files changed, 4 insertions(+), 2 deletions(-)
jump to
M user/emacs/init.el → user/emacs/init.el
@@ -128,11 +128,13 @@ (setq frame-resize-pixelwise t) (defun noct-relative () "Show relative line numbers." - (setq-local display-line-numbers 'relative)) + (when display-line-numbers + (setq-local display-line-numbers 'relative))) (defun noct-absolute () "Show absolute line numbers." - (setq-local display-line-numbers t)) + (when display-line-numbers + (setq-local display-line-numbers t))) (add-hook 'evil-insert-state-entry-hook #'noct-absolute) (add-hook 'evil-insert-state-exit-hook #'noct-relative)