0

In emacs -nw, many shortcuts are bound to something different from the "classical" emacs-gui. For instance:

  • \C-_ is bound to DEL (classically it is undo)
  • backspace is \C-h thus opens help (classically: DEL)
  • \C-backspace is bound to DEL (classically: backward-kill-word)

I'd like to retrieve the ones I'm used to, so following this and that, I've started this init file:

(normal-erase-is-backspace-mode 1)  ; fix backspace and del keys
(global-set-key "\C-_"     'undo)   ; redefine undo... doesn't work, requires a minor-mode, cf https://emacs.stackexchange.com/questions/352/how-to-override-major-mode-bindings
(global-set-key "\M-_"     'undo)   ; that'll do for the moment
; TODO: ctrl-backspace
;       any other?

But it seems I'm reinventing the wheel.

Isn't there already a solution? Probably in the form of a nox-compat-minor-mode?

Demi-Lune
  • 101
  • 4
  • 1
    "Classic" can mean different things, so that's probably not the best term to use here -- I think it could equally refer to the opposite of what you intend it to mean. – phils May 04 '21 at 09:32
  • 2
    I think what you *want* is for key sequences to work the same way in a terminal as they do in GUI Emacs. Is that correct? – phils May 04 '21 at 09:33
  • 1
    (Spoiler -- most terminal emulators can't send Emacs all the key sequences that can be sent in a GUI environment. What's actually possible will very likely depend on the particular terminal emulator you're using.) – phils May 04 '21 at 09:58
  • @phils : yes, it is the key sequence of GUI emacs. I'll clarify the question. – Demi-Lune May 04 '21 at 10:00
  • @phils : yes, I've seen that it will depend on the terminal emulator; that's why I'm interested in a more general solution than my little hand-made fixes. – Demi-Lune May 04 '21 at 10:08
  • 1
    I can't provide you with a solution; but there are many Q&As on ES and SO on the general topic of Emacs keys which don't work in terminals, so I can point you in that direction for further research. https://emacs.stackexchange.com/q/18000 and its links seems like a good place to start, and https://github.com/CyberShadow/term-keys (from one of those answers) might be pretty close to what you're asking for. – phils May 04 '21 at 10:23

0 Answers0