From 40a35392d1f06480e097a821f5ee5e084ac832dc Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 5 Jan 2020 19:14:54 -0500 Subject: [PATCH] Make evil backspace/DEL respect delete-selection-mode Perhaps this should be fixed upstream? --- modules/editor/evil/config.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/editor/evil/config.el b/modules/editor/evil/config.el index 8f39b084e..2364d294b 100644 --- a/modules/editor/evil/config.el +++ b/modules/editor/evil/config.el @@ -161,6 +161,13 @@ directives. By default, this only recognizes C directives.") (advice-add #'evil-open-above :around #'+evil--insert-newline-above-and-respect-comments-a) (advice-add #'evil-open-below :around #'+evil--insert-newline-below-and-respect-comments-a) + ;; Fix backspace/DEL commands not respecting `delete-selection-mode' + (defadvice! +evil-delete-region-if-mark-a (orig-fn &rest args) + :around '(evil-delete-backward-word evil-delete-backward-char-and-join) + (if (and (bound-and-true-p delete-selection-mode) mark-active) + (call-interactively #'backward-delete-char-untabify) + (apply orig-fn args))) + ;; Recenter screen after most searches (dolist (fn '(evil-visualstar/begin-search-forward evil-visualstar/begin-search-backward