Send ctrl-a in tmux after rebinding to it

While tmux provides much better functionality than screen,
most of us that work with tmux have been using screen for a long time,
and it is more comfortable for us to use ctrl-a than the default ctrl-b,
which is finger-strechy. Thus the first thing I will do after installing tmux
is to rebind the prefix to ctrl-a. That gives us the most handy way of
swapping last two windows by typing ctrl-a ctrl-a.
However, this comes for a price. That is, in a shell environment that
is integrated with readline, ctrl-a is used to jump the begining of line.
Now that it is mapped as prefix, we can no longer do that.
Surprisingly, the solution is pretty simple. Just use ctrl-a a to
send the prefix itself, and use ctrl-a ctrl-a to go to the last window.
Specifically, add these two lines in ~/.tmux.conf:
# ~/.tmux.conf
bind a send-prefix
bind-key C-a last-windowvia.
Comments