0

In my .screenrc I have the following stanza:

# Change command key to ctrl+space
escape ^@a

I found this magic incantation in a forum I can no longer find; it allows me to hit ctrl+space to invoke screen commands, so ctrl+space c (or ctrl+space ctrl+c) will create a new window, and ctrl+space space (or ctrl+space ctrl+space) will switch to the last window, etc.

This is very useful in avoiding the problem of precluding the ctrl+a beginning-of-line terminal functionality, is easy to type and doesn't conflict with any standard keybindings.

Can anyone explain why and how this works? I have searched through https://www.gnu.org/software/screen/manual/screen.html for any reference to the character @ and found nothing relevant.

1

With a lot of terminal programs (but not every one), control-SPACE sends the ASCII 00 character (NUL).

You can see this, eg with od -cx and entering control-SPACE, RETURN, control_D. You'll see output similar to:

% od -cx
^@
0000000  \0  \n
           0a00
0000002

Control-@ is also the NUL character (@ is ASCII 64, so control-@ is ASCII 00).

So mapping control-@ inside screen has the effect of mapping control-SPACE... because of how the terminal handles control-SPACE.

  • Wow. And to corroborate further, ctrl+shift+2 (ctrl+@) works for me too :-) – cachvico Jun 13 '18 at 5:24

Your Answer

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

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