commit 1f77ac8121f7c66fc1c38e14c4a806c06912b9fa parent a116812d2d91af4cf553a3bcfd99753e14c627ef Author: Vincent Demeester <vincent@sbr.pm> Date: Fri, 1 May 2020 12:32:36 +0200 config-editing.el: update display-line-numbers Signed-off-by: Vincent Demeester <vincent@sbr.pm> Diffstat:
M | tools/emacs/config/config-editing.el | | | 15 | ++++++++++++--- |
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/tools/emacs/config/config-editing.el b/tools/emacs/config/config-editing.el @@ -104,9 +104,18 @@ (global-set-key [remap kill-ring-save] 'easy-kill) (global-set-key [remap mark-sexp] 'easy-mark)) -(setq display-line-numbers-type 'relative) -(add-hook 'prog-mode-hook - 'display-line-numbers-mode) +(use-package display-line-numbers + :hook (prog-mode . display-line-numbers-mode) + :config + (setq-default display-line-numbers-type 'relative) + (defun sbr/toggle-line-numbers () + "Toggles the display of line numbers. Applies to all buffers." + (interactive) + (if (bound-and-true-p display-line-numbers-mode) + (display-line-numbers-mode -1) + (display-line-numbers-mode))) + :bind ("<f7>" . sbr/toggle-line-numbers)) + (add-hook 'prog-mode-hook 'toggle-truncate-lines) (use-package newcomment