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?

6
  • 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 4 at 9: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 4 at 9: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 4 at 9:58
  • @phils : yes, it is the key sequence of GUI emacs. I'll clarify the question. – Demi-Lune May 4 at 10:00
  • 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. emacs.stackexchange.com/q/18000 and its links seems like a good place to start, and github.com/CyberShadow/term-keys (from one of those answers) might be pretty close to what you're asking for. – phils May 4 at 10:23

Your Answer

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

Browse other questions tagged or ask your own question.