3

I would like to bind C-h to do exactly the same thing as backspace, no matter the mode I'm in. So far I bound C-h to delete-backward-char in global-map, but the results are inconsistent across the modes (it doesn't work well with electric-pair for example, python mode is broken as well).

1

I use (define-key key-translation-map [?\C-h] [?\C-?]), this also works for when backspaces as parts of key sequences, e.g.

C-x DEL (translated from C-x C-h) runs the command
backward-kill-sentence
0

I found the answer, for future reference:

(global-set-key (kbd "C-h") (kbd "<backspace>"))
  • Please consider accepting your own answer. Having an accepted answer can help readers. – Drew Jan 15 at 21:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.