Last active
May 26, 2024 13:34
-
-
Save jamescherti/8a7c6e926fcb6a16251bc24b1fe06bcf to your computer and use it in GitHub Desktop.
Fix Electric Pair delete adjacent pair when C-h is pressed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Gits URL: https://gist.github.com/jamescherti/8a7c6e926fcb6a16251bc24b1fe06bcf | |
;; License: MIT | |
;; Author: James Cherti | |
;; | |
;; Description: | |
;; ------------ | |
;; When the C-h key is pressed in Emacs Evil mode, and | |
;; electric-pair-delete-adjacent-pairs is set to true, Electric Pair should | |
;; delete an adjacent pair of characters, similar to the behavior of the | |
;; Backspace key. Currently, this functionality only works with the Backspace | |
;; key. The following function resolves the issue by making C-h emulate the | |
;; DEL / Backspace key. | |
(defun my-simulate-backspace-key-press () | |
"Simulates the pressing of the Backspace key." | |
(interactive) | |
(let ((backspace-command (key-binding (kbd "DEL")))) | |
(when backspace-command | |
(call-interactively backspace-command)))) | |
(evil-define-key 'insert 'global (kbd "C-h") #'my-simulate-backspace-key-press) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment