From c9e55e8c3bca90200624bffb3cfc230b25a044f1 Mon Sep 17 00:00:00 2001 From: MitchMarq42 Date: Mon, 10 Oct 2022 12:16:37 -0800 Subject: [PATCH] Screen line motion now works as originally envisioned --- lisp/mitch-defuns.el | 11 +++++++++++ lisp/mitch-packages.el | 8 ++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lisp/mitch-defuns.el b/lisp/mitch-defuns.el index 953292a..944fe6a 100644 --- a/lisp/mitch-defuns.el +++ b/lisp/mitch-defuns.el @@ -17,6 +17,17 @@ (defun mitch/evil-config () "A batch of commands to run as the :config of evil's `use-package'. Made solely to reduce lines in the init-file." + ;; Visual moving + (defun move-screen-down-line () + "Scroll down line but keep cursor in same visual position." + (interactive) + (evil-previous-line) + (scroll-down-line)) + (defun move-screen-up-line () + "Scroll up line but keep cursor in same visual position." + (interactive) + (evil-next-line) + (scroll-up-line)) ;; Make evil-join combine lines. Taken from https://github.com/hlissner/doom-emacs/commit/40cf6139ed53b635fec37ce623c4b1093c78a11e ;; (evil-define-operator +evil-join-a (beg end) ;; "Join the selected lines. diff --git a/lisp/mitch-packages.el b/lisp/mitch-packages.el index 78a55a9..0ea549f 100644 --- a/lisp/mitch-packages.el +++ b/lisp/mitch-packages.el @@ -73,12 +73,8 @@ (general-define-key :states 'normal "" 'evil-beginning-of-line - "j" (general-key-dispatch 'evil-next-visual-line - :timeout 0.025 - "j" 'scroll-up-line) - "k" (general-key-dispatch 'evil-previous-visual-line - :timeout 0.025 - "k" 'scroll-down-line)) + "C-n" 'move-screen-up-line + "C-p" 'move-screen-down-line) (general-define-key :states 'insert "C-w" 'evil-window-map