GNU Screen is a terminal multiplexing utility that has the following concrete advantages:
However, text-mode junkie Emacs enthusiasts who would also be GNU screen lovers, may find the biggest stumbling block to the path of enlightenment is the out of the box setting for the Command Key.
‘beginning-of-line’. It is also the command key for GNU Screen, which causes a problem of “muscle memory impedence matching.”
# ## Control-^ (usually Control-Shift-6) is traditional and the only key not used by emacs escape ^^^^ # ## do not trash BackSpace, usually DEL bindkey -k kb bindkey -d -k kb # ## do not trash Delete, usually ESC [ 3 ~ bindkey -k kD bindkey -d -k kD
Put the following (for example) into your .screenrc to use `C-\’ as the command key:
But be aware that C-\ sends SIGABRT to the foreground process. I ended up killing many programs because of typos and muscle-memory. (fadein)
I really like rebinding it to C-o, this way you can flip between split screens quickly C-o C-i (BasKok):
I use C-] (Anonymous):
I like Ctrl-Space. Besides Emacs, I haven’t encountered another program that uses this control character. Moreover, your thumb is always on the spacebar, making this as fast as a home-row escape key (fadein):
I (piyo) use C-T because it doesn’t collide with anything else other than M-x transpose-char and your favorite shell’s transpose-char (often used bindkey setting). C-z is too risky because it’s a Unix (suspend-emacs) and Windows (undo) vital key. Though they are all great unique keystrokes, C-] and C-\ and C-o are two-handed and too far away. I suppose C-o is good because it replaces the useless M-x open-line. But still I assert C-T’s dominance (haha). Make sure to bind C-T C-T to self-insert a C-T, so you don’t lose your transpostion-ness muscle memory. Here’s a .screenrc excerpt sample:
# Define a sane GNU screen command entry character # first letter defines the screen command key. # second letter defines the literal insert key. escape "^T^T"
Is there anyway to use C-; ?? I’ve tried a million combinations including RTFM but can’t seem to get it working (nimms).
Best feature is detach/reattach, e.g.,
$ screen -D -R
disconnects your old terminal session and reconnects the same session at your new location. Especially great when bad network connections randomly disconnect you, no problem, seamlessly picks up where you were.
Next best feature is sharing, e.g.,
# ## console sharing multiuser on acladd mypal
$ screen -x mypal/
be sure you trust ‘em to spy on your screen and type on your keyboard.
Version 4.x seems fine, a bug in prior versions fails to enable sending mouse events, workaround by
$ ps -auxwww | grep [s]creen ... pty/0 ... screen ... $ echo -e '\e[?1000h' > /dev/pty/0-or-whatever-tty-screen-is-sending-to
which you’d do at each login - easier to upgrade.
I’m not sure if this is truly a bug, but it is a frustration to which I haven’t found a solution. I’ve found that when pasting text from a Word document or other windows source into emacs -nw running in SecureCRT?, that characters such as ‘ and - and bullet characters can have negative interactions with text mode and/or filladapt mode such that instead of getting all of your pasted text, it gets chopped up as though the punctuation and special characters are being interpreted as cursor movement or line deletes, or the like. I can’t say the root cause with any certainty, but I have found that dropping out of screen and running emacs -nw from a plainer terminal seems to not have the problem.
If you get the message
Cannot find terminfo entry for 'eterm-color'. try copying the
cp /usr/share/terminfo/e/eterm /usr/share/terminfo/e/eterm-color
If the remote server is SunOS?, we might need to put the following
in the remote server’s
In a given Screen or tmux window, if you’ll be connecting to a remote shell, there’s the mosh project . Along with its state synchronisation protocol, it allows for fast local responsiveness, and it supports roaming - making it a great drop-in replacement for ssh (and thus a practical possibility to connect to a remote host over a slow internet connection). Does anyone else think it would be a good idea  to implement an Emacs mosh client?
Put the following line into your `.screenrc`:
You will also need to create a file called `term/screen-256color.el`someplace your load-path can find. Inside the file, put the following code block into it:
(defun terminal-init-screen () "Terminal initialization function for screen-256color." (load "term/xterm") (xterm-register-default-colors) (tty-set-up-initial-frame-faces))
If the planets have aligned correctly, you should know see colors other than the standard 8/16. You can verify this using `M-x list-colors-display`; if you set things up correctly there should be lots of colors
There is a possibility that your distro might not include any terminfo data for screen-256color by default. On Debian systems, you can install it yourself:
# aptitude install ncurses-term
If this does not work either, the last resort is to attempt setting using `term xterm-256color` in your `.screenrc`. This should work fine, but is a bodge since the terminal is technically screen itself, not the xterm. If it breaks, you get to keep both pieces.
Thanks to  for helping find some correct information.
How do people handle multiple emacs sessions within screen. I often have two or more emacs sessions within screen looking at different files. What method do people use to copy between multiple sessions? Screen’s copy capabilities? Or is there a way to use the kill-ring between emacs sessions? If I use Screen’s copy I cannot scroll through the emacs buffer. If I use the emacs kill-ring I cannot paste on a different emacs session. Does anyone have a solution for this?
You could use emacs as server : `emacs --daemon` and `emacsclient -t`.