emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/evil 00fca68547: Add C-h in insert + replace states (fixes


From: ELPA Syncer
Subject: [nongnu] elpa/evil 00fca68547: Add C-h in insert + replace states (fixes #1577)
Date: Thu, 17 Feb 2022 02:58:00 -0500 (EST)

branch: elpa/evil
commit 00fca685479e772361765b13de4689099a328c28
Author: Tom Dalziel <tom_dl@hotmail.com>
Commit: Tom Dalziel <33435574+tomdl89@users.noreply.github.com>

    Add C-h in insert + replace states (fixes #1577)
---
 evil-maps.el |  4 ++++
 evil-vars.el | 37 +++++++++++++++++++++++++++++++------
 2 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/evil-maps.el b/evil-maps.el
index a4d20aa87f..971cf7ab70 100644
--- a/evil-maps.el
+++ b/evil-maps.el
@@ -405,6 +405,8 @@
        '("\C-w" . evil-window-map))
     ,@(when evil-want-C-u-delete
         '(("\C-u" . evil-delete-back-to-indentation)))
+    ,@(when evil-want-C-h-delete
+        '(("\C-h" . evil-delete-back-to-indentation)))
     ([mouse-2] . mouse-yank-primary))
   "Evil's bindings for insert & replace states.
 Used in `evil-insert-state-map' and `evil-replace-state-map',
@@ -446,6 +448,8 @@ included in `evil-insert-state-bindings' by default."
 (dolist (binding evil-insert-state-bindings)
   (define-key evil-replace-state-map (car binding) (cdr binding)))
 (define-key evil-replace-state-map (kbd "DEL") 'evil-replace-backspace)
+(when evil-want-C-h-delete
+  (define-key evil-replace-state-map "\C-h" 'evil-replace-backspace))
 (define-key evil-replace-state-map [escape] 'evil-normal-state)
 (define-key evil-replace-state-map [insert] 'evil-append)
 
diff --git a/evil-vars.el b/evil-vars.el
index 0a0b14d2ea..72003ecd9a 100644
--- a/evil-vars.el
+++ b/evil-vars.el
@@ -514,15 +514,18 @@ ubiquity of prefix arguments."
   :group 'evil
   :set #'(lambda (sym value)
            (set-default sym value)
-           (when (boundp 'evil-insert-state-map)
+           (when (and (boundp 'evil-insert-state-map)
+                      (boundp 'evil-replace-state-map))
              (cond
               ((and (not value)
                     (eq (lookup-key evil-insert-state-map (kbd "C-u"))
                         'evil-delete-back-to-indentation))
-               (define-key evil-insert-state-map (kbd "C-u") nil))
+               (define-key evil-insert-state-map (kbd "C-u") nil)
+               (define-key evil-replace-state-map (kbd "C-u") nil))
               ((and value
                     (not (lookup-key evil-insert-state-map (kbd "C-u"))))
-               (define-key evil-insert-state-map (kbd "C-u") 
'evil-delete-back-to-indentation))))))
+               (define-key evil-insert-state-map (kbd "C-u") 
'evil-delete-back-to-indentation)
+               (define-key evil-replace-state-map (kbd "C-u") 
'evil-delete-back-to-indentation))))))
 
 (defcustom evil-want-C-w-delete t
   "Whether `C-w' deletes a word in Insert state."
@@ -530,16 +533,38 @@ ubiquity of prefix arguments."
   :group 'evil
   :set #'(lambda (sym value)
            (set-default sym value)
-           (when (boundp 'evil-insert-state-map)
+           (when (and (boundp 'evil-insert-state-map)
+                      (boundp 'evil-replace-state-map))
              (cond
               ((and (not value)
                     (eq (lookup-key evil-insert-state-map (kbd "C-w"))
                         'evil-delete-backward-word))
-               (define-key evil-insert-state-map (kbd "C-w") 'evil-window-map))
+               (define-key evil-insert-state-map (kbd "C-w") 'evil-window-map)
+               (define-key evil-replace-state-map (kbd "C-w") 
'evil-window-map))
               ((and value
                     (eq (lookup-key evil-insert-state-map (kbd "C-w"))
                         'evil-window-map))
-               (define-key evil-insert-state-map (kbd "C-w") 
'evil-delete-backward-word))))))
+               (define-key evil-insert-state-map (kbd "C-w") 
'evil-delete-backward-word)
+               (define-key evil-replace-state-map (kbd "C-w") 
'evil-delete-backward-word))))))
+
+(defcustom evil-want-C-h-delete nil
+  "Whether `C-h' deletes a char in Insert state."
+  :type 'boolean
+  :group 'evil
+  :set #'(lambda (sym value)
+           (set-default sym value)
+           (when (and (boundp 'evil-insert-state-map)
+                      (boundp 'evil-replace-state-map))
+             (cond
+              ((and (not value)
+                    (eq (lookup-key evil-insert-state-map (kbd "C-h"))
+                        'evil-delete-backward-char-and-join))
+               (define-key evil-insert-state-map (kbd "C-h") nil)
+               (define-key evil-replace-state-map (kbd "C-h") nil))
+              ((and value
+                    (not (lookup-key evil-insert-state-map (kbd "C-h"))))
+               (define-key evil-insert-state-map (kbd "C-h") 
'evil-delete-backward-char-and-join)
+               (define-key evil-replace-state-map (kbd "C-h") 
'evil-replace-backspace))))))
 
 (defcustom evil-want-C-g-bindings nil
   "Whether `C-g' postfix can be used in bindings."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]