24

I have been using GNU screen for a couple of days and the CTRL-A navigation is beginning to wear on me. How can I remap this key combo and what are some common replacements for these keys? For example, in Vim I use jj instead of <esc> because it doesn't require me to break my typing form.

Note: Alex explains how to map the key combo, however, adding the binding to .screenrc did not work for me. I added it to etc\screenrc and that worked. The .screenrc method seems to work for most people, I am not sure why not on my system.

20

To make it CTRL+J, use the following in .screenrc.

escape ^Jj

To quote the manpage,

 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".

  • When the changes are made, CTRL+J is supposed to function as CTRL+A is that correct? – Dru May 8 '12 at 20:14
  • I have escape ^Jj^ in my root directory's .screenrc file and the user's home directory's file. I rebooted screen and also restarted the ssh session that I was in. None of these worked, I expected CTRL+J to behave as CTRL+A – Dru May 8 '12 at 20:15
  • Do you have an extra caret on the end of that? Should be escape ^Jj, not escape ^Jj^. – Alex Hirzel May 8 '12 at 20:54
  • 1
    Maybe there's a conflict with other bindings but I have tried several keys. – Dru May 8 '12 at 21:10
  • 5
    You can also just press Ctrl + a, and type ': escape ^Jj' (like in vi) to change the mapping dynamically. – rags Oct 31 '12 at 10:45
11

Similar to the solution of @Alex Hirzel but I prefer using keybinding Ctrl+^ (Ctrl+Shift+6) as it is never used in emacs keybindings.

Just write in ~/.screenrc as follows:

escape ^^^

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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