8

In GNU screen, I can keep Ctrl+a pressed in between commands.

For instance, to change windows I keep Ctrl+a pressed and just keep pressing n without releasing Ctrl+a.

Is this doable in tmux? Currently I need to release Ctrl+a in between commands.

(By the way, I changed the default prefix from Ctrl+b to Ctrl+a)

4 Answers 4

11

Holding down Control to enter multiple Control-modified keys is fairly standard. I am not sure if there is any kind of standard that controls what a terminal will send when you hold Control+A while also typing Control+N. The ones I tried are all consistent though: once I press N they all act as if I had released A (if ^A was auto-repeating, it stops; if I continue to hold ^N, then it starts to auto-repeat).

If the terminal under which you run tmux works similarly to the ones I tried, then you could use this (in your .tmux.conf, or directly in tmux after (your prefix) then :):

bind-key -r ^N next-window

The -r gives you 500ms (default, can be changed with the repeat-time session option) to press the key again (really, any -r flagged, “repeatable” key) without having to press the prefix key again: type your prefix key once, (release it, or not, depending on your terminal), then type any number of “repeatable” keys (as long as they are all within the configured timeout).

If you find yourself releasing both of Control and A, then you might also want to make plain N repeatable (via bind-key -r n next-window) so that both the plain and Control-modified versions are repeatable.

3
  • This is not exactly what I was looking for but I've been using it for the last hour and so far does the job, thanks! Mar 29, 2011 at 12:47
  • Just starting with tmux.. is setting the repeat-time the only way to accomplish this? Coming from VIM I'm finding working with this delay to be too flakey.. takes too much finesse instead of working everytime.. do you get used to it? Or is there a better way?
    – Inc1982
    Nov 13, 2012 at 4:13
  • @Inc1982: The repeat-time value and the use of the -r option in bindings are the only ways to control it that I know of. You can set repeat-time to zero to disable the functionality for all repeatable keys, or you could selectively rebind certain keys without the -r flag. Nov 13, 2012 at 6:00
3

Another way is to have

bind-key C-c new-window bind-key c new-window

What you are describing is a series of inputs Ctrl-A, Ctrl-c as opposed to Ctrl-a, c which is what screen does.

From what I've heard (but not absolutely certain), screen has both of these bindings, but since you don't have to specify them in the .rc file, you're not really aware of them.

You should look at some example .tmux.conf files on the web if you want it to act closer to screen

2

The plugin tmux-sensible fixes this for me.
https://github.com/tmux-plugins/tmux-sensible

I recommend tpm to install it.
https://github.com/tmux-plugins/tpm#installation
https://github.com/tmux-plugins/tmux-sensible#installation-with-tmux-plugin-manager-recommended

0

This is an old question, but I just created https://github.com/mavenraven/tmux-screen based on the answers for future people who are migrating off screen.

You must log in to answer this question.

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