From de1ffbca11d0d759234eef266ded0053dfc113ba Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 7 Sep 2024 14:49:18 -0400 Subject: [PATCH] feat: distinguish [C-m] key from RET Now, uses can rebind ctrl+m by targeting [C-m] (or "", same thing), and it won't rebind RET. This will only work in GUI Emacs, however, and there is no kkp support for this one. Ref: 96d7e50f3e1a --- lisp/doom-keybinds.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lisp/doom-keybinds.el b/lisp/doom-keybinds.el index 9c797eaf8..2ff1bcfe0 100644 --- a/lisp/doom-keybinds.el +++ b/lisp/doom-keybinds.el @@ -68,6 +68,17 @@ and Emacs states, and for non-evil users.") (key-binding (vconcat (cl-subseq keys 0 -1) [C-i]) nil t))) [C-i] [?\C-i]))) +;; HACK: Same as C-i, but C-m is a little harder. There is no workaround for +;; this for the terminal. +(define-key input-decode-map + [?\C-m] (cmd! (if (when-let ((keys (this-single-command-raw-keys))) + (and (display-graphic-p) + (not (cl-position 'return keys)) + (not (cl-position 'kp-return keys)) + ;; Fall back if no keybind can be found. + (key-binding (vconcat (cl-subseq keys 0 -1) [C-m]) nil t))) + [C-m] [?\C-m]))) + ;; ;;; Universal, non-nuclear escape