commit 12fb8fa4669d254650066dc495273a26373c6f36 parent 14bd7058775313f96ca749c7fa7de1667794f67c Author: Vincent Demeester <vincent@sbr.pm> Date: Tue, 18 Aug 2020 18:42:58 +0200 tools/emacs: add scroll configuration… … and center minor mode. Signed-off-by: Vincent Demeester <vincent@sbr.pm> Diffstat:
M | tools/emacs/config/config-navigating.el | | | 25 | +++++++++++++++++++++++++ |
1 file changed, 25 insertions(+), 0 deletions(-)
diff --git a/tools/emacs/config/config-navigating.el b/tools/emacs/config/config-navigating.el @@ -3,6 +3,31 @@ ;;; Navigation related configuration ;;; Code: +(use-package emacs + :config + (setq-default scroll-preserve-screen-position t) + (setq-default scroll-conservatively 1) ; affects `scroll-step' + (setq-default scroll-margin 0) + + (define-minor-mode vde/scroll-centre-cursor-mode + "Toggle centred cursor scrolling behaviour." + :init-value nil + :lighter " S=" + :global nil + (if vde/scroll-centre-cursor-mode + (setq-local scroll-margin (* (frame-height) 2) + scroll-conservatively 0 + maximum-scroll-margin 0.5) + (dolist (local '(scroll-preserve-screen-position + scroll-conservatively + maximum-scroll-margin + scroll-margin)) + (kill-local-variable `,local)))) + + ;; C-c l is used for `org-store-link'. The mnemonic for this is to + ;; focus the Line and also works as a variant of C-l. + :bind ("C-c L" . vde/scroll-centre-cursor-mode)) + (use-package avy :disabled :bind (("C-c j" . avy-goto-word-1)