Useful key bindings

  • PREFIX-w: choose-window - displays windows for user to choose interactively
  • PREFIX-:: activate tmux command line (wtih tab completion)
  • PREFIX-q: display window ID for each window

The choose window is so useful when I'm terminal'ing from iPhone that I assign F10 to it:

bind-keys -n F10 choose-window

Deal with nested sessions

Tmux offers two main benefit - terminal multiplexing, and process persistence. Usually you should avoid nested tmux sessions. But in case inside a tmux session, you ssh to a remote machine and do stuff, you would want a tmux session on the remote as well. First of, I suggest using that inner tmux only for process persistence, not terminal multiplexing, b/c passing tmux prefix keys into that inner one is not convenient.

Then here's the magic for the second point - inner tmux (remote) is only for process persistence, meaning, that tmux session only host one process (be it a shell, or vim, etc.). In this case, you don't really need the inner tmux to have a status bar, nor a prefix key.

  1. To getting rid of the status bar, use set status off.
  2. To disable prefix keys, use set prefix None.

Actually, I have a little shell script for launching this:

1
2
3
#!/bin/sh
session="$1"; shift
tmux new -A -s "$session" \; set prefix None \; set status off

Note that after disabling prefix key, you won't be able to manipulate that tmux session from inside it. Well most likely you don't need to, because it's single process, and you have a outer tmux. But just for entertaining purpose, you can control it from shell, inside that session:

1
2
3
tmux detach
# or more generally, run any tmux command:
tmux <tmux-cmd>