4

The default "command character" for GNU-screen is C-a, which collides with the default key combination for move-beginning-of-line in Emacs, and for the analogous command of many other interfaces.

It is difficult to find an alternative command character for GNU-screen that does not collide with some common Emacs binding. And for users of org-mode the problem is considerably worse.

I figure that there must be enough users of both GNU-screen and org-mode (and also of Emacs, of course) for there to be a widely accepted solution to this problem.

3
  • 1
    "...widely accepted solution..." I like your optimism.
    – Emacs User
    Commented Nov 20, 2015 at 18:55
  • I use tmux, so I'm not sure if the keybinding also works on screen, but I use M-0 (Alt-zero). I chose the character since its a numeric prefix, but there is hardly ever a reason to use 0 as a prefix, and in any case C-0 would work in the same manner
    – Joafigue
    Commented Nov 20, 2015 at 20:25
  • Related: emacswiki.org/emacs/GnuScreen
    – gdelfino
    Commented Nov 7, 2022 at 15:45

3 Answers 3

6

Not sure how widely accepted this is, but C-z works reasonably well. By default in emacs that is bound to suspend-frame, and shell uses it for suspend/background task. Emacs also binds C-x C-z to suspend-frame so there is another binding anyway. If escape ^Zz is set for screen, C-z z will send a C-z to the nested process to background.

This also works for tmux with

set -g prefix C-z                                                                                         
unbind C-b                                                                                                
bind C-z send-prefix    

For tmux this means sending C-z to a nested application can be accomplished with C-z C-z.

Some additional reasons why C-z is a good idea:

  • suspend is a means of multi-tasking in a single shell session, whereas default workflow in screen/tmux is to open a new nested shell.
  • suspend is still available but only one extra keystroke away (which befits the frequency of it's use for my workflow)
  • It's an easy single hand binding (which might not be great for RSI) but makes it easier to use one-handed (if eating or mostly reading).
  • In most other contexts it's bound to undo.
2
  • 1
    C-z is a great solution not just for screen, but also tmux -- perhaps could even become a "widely accepted solution."
    – Emacs User
    Commented Nov 21, 2015 at 5:10
  • 1
    C-z is very useful to put Emacs in the background. I use C-o as my control character. It's not perfect, it coincides with open-line, but I don't use that as often.
    – suvayu
    Commented Nov 21, 2015 at 17:34
1

C-j is rarely used inside or outside Emacs, and it's right on the home row.

0

C-b is only used for backward-char.

1
  • Yes this is a reasonable compromise if the C-z solution as proposed by dgtized is not possible for some reason.
    – Emacs User
    Commented Nov 21, 2015 at 5:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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