3

GNU Screen's default meta-key is Ctrl-a, which is really inconvenient for me because I frequently use Ctrl-a and Ctrl-e to move the cursor to the beginning or end of the line.

I'd prefer to change this to Cmd-a instead. I know this can be changed in my .screenrc file, but how do I encode the Cmd key?

  • I assume you use Ctrl-a too often to get used to Ctrl-a (release ctrl) a to send Ctrl-a to the shell? - The problem with Cmnd-a is that it is the builtin for "Select All Text", which I am not sure how you will be able to undo. – Jason Salaz Apr 19 '11 at 23:12
  • @VxJasonxV hmm, I may be able to live with Ctrl-a,a but yeah I will probably mess it up too often. If Cmd-a won't work I'd settle for something like Shift-Cmd-a. – Adam Lassek Apr 19 '11 at 23:22
  • Also see superuser.com/questions/142680/… – Stefan Lasiewski Apr 26 '12 at 20:18
4

I generally think the command idea is a bad one, because it is intended to be the system key for app manipulation. Cmd-l appears to be unbound in the application menus, but I couldn't use any tricks to view what it's keycode may be. Thus, I would suggest Shift-Ctrl-a.

Having said that, if I understand the man page, and a resource on the Ubuntu Forums on the topic, I believe you can change it to Shift-Ctrl-a either by using the -e flag (which I suggest you use to test with before putting it in your ~/.screenrc).

You should be able to run screen -e ^AA. ^ is a common identifier for "Ctrl", and A means capital-a (shift + a), as opposed to a lowercase a, meaning the character by itself.

If that works, you should be able to add a line into your ~/.screenrc that says: escape ^AA for it to automatically take place on any standard execution of screen just by itself.

  • I personnaly prefer ctrl-@ shorcut, which is more convenient because one need to only press two keys (ctrl-@) instead of three (ctrl-shift-a). Achieved with escape ^@@ in ~/.screenrc. But it is a personnal preference ;-) – lauhub Sep 10 '17 at 11:34
0

As usual, I would also recommend trying out tmux. It's kind of a "screen on steroids". It uses C-b as its prefix key, but even that is configurable. tmux allows you to easily configure every aspect of it. As per the tmux FAQ, you can change the prefix to C-a like this:

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

Of course, since you wanted to get rid of C-a anyway, you may be happy with C-b instead.

You can easily install tmux if you have MacPorts installed, by running:

sudo port install tmux
  • Thanks, for the record I have long since switched to tmux. – Adam Lassek May 31 '13 at 18:57
-1

run 'cat' in a terminal and press cmd-a to see what characters it sends. You can then use that in your .screenrc

  • 2
    Welcome to the site! How does this differ from the other answer? If it does, can you please elaborate your answer a bit to make it easier to understand and follow? – nohillside May 31 '13 at 10:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .