Johan Engstrand: 4 contrib: emacs-evil: Add evil-commentary and evil-surround. contrib: emacs-evil: Make j/k motions behave properly (e.g. for dj). contrib: emacs-evil: Add vi-like undo and redo binds with undo-fu. contrib: emacs-evil: Add option to hide evil state messages. 4 files changed, 28 insertions(+), 5 deletions(-)
Copy & paste the following snippet into your terminal to import this patchset into git:
curl -s https://lists.sr.ht/~abcdw/rde-devel/patches/41453/mbox | git am -3Learn more about email & git
--- src/contrib/features/emacs-xyz.scm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/contrib/features/emacs-xyz.scm b/src/contrib/features/emacs-xyz.scm index 75cd16a..ff2bfa6 100644 --- a/src/contrib/features/emacs-xyz.scm +++ b/src/contrib/features/emacs-xyz.scm @@ -40,12 +40,16 @@ #:key (emacs-evil emacs-evil) (emacs-evil-collection emacs-evil-collection) + (emacs-evil-commentary emacs-evil-commentary) + (emacs-evil-surround emacs-evil-surround) (emacs-evil-org emacs-evil-org) (emacs-undo-fu emacs-undo-fu)) "Configure evil-mode for emacs. The feature is in contrib because the recommended RDE experience is to rely on Emacs default keybindings." (ensure-pred file-like? emacs-evil) (ensure-pred file-like? emacs-evil-collection) + (ensure-pred file-like? emacs-evil-commentary) + (ensure-pred file-like? emacs-evil-surround) (ensure-pred file-like? emacs-evil-org) (ensure-pred file-like? emacs-undo-fu) @@ -66,7 +70,9 @@ recommended RDE experience is to rely on Emacs default keybindings." (eval-when-compile (require 'evil) - (require 'evil-collection)) + (require 'evil-collection) + (require 'evil-commentary) + (require 'evil-surround)) (setq evil-want-keybinding nil) @@ -74,7 +80,9 @@ recommended RDE experience is to rely on Emacs default keybindings." (evil-collection-init)) (with-eval-after-load 'evil-autoloads - (evil-mode 1)) + (evil-mode 1) + (evil-commentary-mode) + (global-evil-surround-mode 1)) (setq evil-want-integration t) (setq evil-want-C-u-scroll t) @@ -155,6 +163,7 @@ recommended RDE experience is to rely on Emacs default keybindings." (require 'evil-org-agenda) (evil-org-agenda-set-keys)))) #:elisp-packages (list emacs-evil emacs-evil-collection emacs-evil-org + emacs-evil-commentary emacs-evil-surround emacs-undo-fu) #:authors '("Nicolas Graves <ngraves@ngraves.fr>") #:summary "\
Thank you for the patches, reviewed, applied, pushed. I didn't test them, so let me know if something will go wrong. CCed Nicolas.
-- 2.40.1
--- src/contrib/features/emacs-xyz.scm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/contrib/features/emacs-xyz.scm b/src/contrib/features/emacs-xyz.scm index ff2bfa6..907de5b 100644 --- a/src/contrib/features/emacs-xyz.scm +++ b/src/contrib/features/emacs-xyz.scm @@ -119,8 +119,10 @@ recommended RDE experience is to rely on Emacs default keybindings." (kbd "C-h") 'evil-delete-backward-char-and-join) ;; Use visual line motions even outside of visual-line-mode buffers - (evil-global-set-key 'motion "j" 'evil-next-visual-line) - (evil-global-set-key 'motion "k" 'evil-previous-visual-line) + (define-key evil-motion-state-map (kbd "j") 'evil-next-visual-line) + (define-key evil-motion-state-map (kbd "k") 'evil-previous-visual-line) + (define-key evil-operator-state-map (kbd "j") 'evil-next-line) + (define-key evil-operator-state-map (kbd "k") 'evil-previous-line) (evil-define-key '(normal insert visual) org-mode-map (kbd "C-j") 'org-next-visible-heading) -- 2.40.1
--- src/contrib/features/emacs-xyz.scm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/contrib/features/emacs-xyz.scm b/src/contrib/features/emacs-xyz.scm index 907de5b..aafa017 100644 --- a/src/contrib/features/emacs-xyz.scm +++ b/src/contrib/features/emacs-xyz.scm @@ -90,6 +90,7 @@ recommended RDE experience is to rely on Emacs default keybindings." (setq evil-want-minibuffer t) (setq evil-respect-visual-line-mode t) (setq evil-undo-system 'undo-fu) + (setq evil-want-fine-undo t) ;; Since =evil-mode= take over =C-u= for buffer scrolling, ;; the =universal-argument= command needs to be rebind to another key @@ -123,6 +124,9 @@ recommended RDE experience is to rely on Emacs default keybindings." (define-key evil-motion-state-map (kbd "k") 'evil-previous-visual-line) (define-key evil-operator-state-map (kbd "j") 'evil-next-line) (define-key evil-operator-state-map (kbd "k") 'evil-previous-line) + ;; undo and redo + (define-key evil-normal-state-map (kbd "u") 'undo-fu-only-undo) + (define-key evil-normal-state-map (kbd "C-r") 'undo-fu-only-redo) (evil-define-key '(normal insert visual) org-mode-map (kbd "C-j") 'org-next-visible-heading) -- 2.40.1
--- src/contrib/features/emacs-xyz.scm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/contrib/features/emacs-xyz.scm b/src/contrib/features/emacs-xyz.scm index aafa017..b0dc8eb 100644 --- a/src/contrib/features/emacs-xyz.scm +++ b/src/contrib/features/emacs-xyz.scm @@ -43,7 +43,8 @@ (emacs-evil-commentary emacs-evil-commentary) (emacs-evil-surround emacs-evil-surround) (emacs-evil-org emacs-evil-org) - (emacs-undo-fu emacs-undo-fu)) + (emacs-undo-fu emacs-undo-fu) + (hide-state-message? #f)) "Configure evil-mode for emacs. The feature is in contrib because the recommended RDE experience is to rely on Emacs default keybindings." (ensure-pred file-like? emacs-evil) @@ -52,6 +53,7 @@ recommended RDE experience is to rely on Emacs default keybindings." (ensure-pred file-like? emacs-evil-surround) (ensure-pred file-like? emacs-evil-org) (ensure-pred file-like? emacs-undo-fu) + (ensure-pred boolean? hide-state-message?) (define emacs-f-name 'evil) (define f-name (symbol-append 'emacs- emacs-f-name)) @@ -112,6 +114,12 @@ recommended RDE experience is to rely on Emacs default keybindings." (define-key map (kbd "C-k") 'previous-line-or-history-element) (define-key map (kbd "C-r") 'consult-history)) + ,@(if hide-state-message? + `(;; Hide state messages, rely on "<N>", "<I>" and "<V>" in modeline + (setq evil-insert-state-message nil) + (setq evil-visual-state-message nil)) + '()) + (with-eval-after-load 'evil (add-hook 'evil-mode-hook 'rde-evil-hook) -- 2.40.1