gnu screen - changing the default escape command key to ALT-X?

Siva picture Siva · Oct 9, 2009 · Viewed 23.3k times · Source

In GNU screen, I want to change the default command binding to Alt-s (by tweaking .screenrc) instead of the default C-a, the reason is I use emacs hence GNU screen binds the C-a key, sending "C-a" to the emacs becomes tedious (as @Nils said, to send "C-a" I should type "C-a a"), as well as "C-a" in bash shell, and I could change the escape to C- but some of them are already mapped in emacs and other combinations are not as easy as ALT-s . If anyone has already done a ALT key mapping, please do let me know.

Answer

rampion picture rampion · Oct 9, 2009

From my reading of man screen it seems like the only meta character that screen can use for the command binding is CTRL:

   escape xy

   Set  the  command character to x and the character generating a literal
   command character (by triggering the "meta" command) to y (similar to
   the -e option).  Each argument is either a single character, a two-character
   sequence of the form "^x" (meaning "C-x"), a backslash followed by an octal
   number (specifying the ASCII code of the character),  or a backslash followed
   by a second character, such as "\^" or "\\".  The default is "^Aa".

If there is some mapping that you don't use in emacs, even if it's inconvenient, like C-|, then you could use your terminal input manager to remap ALT-X to that, letting you use the ALT binding instead. That would be a little hackish though.