My problem is I can't make tmux
key bindings to switch windows.
I'm running tmux
terminal multiplexer on the FreeBSD server. tmux
is started automatically for all remote logins using ~/.bash_profile
:
if [ $TERM = "xterm" ]; then
( (tmux has-session -t remote && tmux attach-session -t remote) \
|| (tmux new-session -s remote) ) && exit 0
echo "tmux failed to start"
fi
By default, tmux
windows are switched using Ctrl+B 1, Ctrl+B 2 ...
I want to switch tmux
windows using F1, F2 ...
So I added the following lines to ~/.tmux.conf
:
bind-key -n F1 select-window -t :1
bind-key -n F2 select-window -t :2
bind-key -n F3 select-window -t :3
bind-key -n F4 select-window -t :4
bind-key -n F5 select-window -t :5
bind-key -n F6 select-window -t :6
bind-key -n F7 select-window -t :7
bind-key -n F8 select-window -t :8
bind-key -n F9 select-window -t :9
Now when I login and press F1, tmux
says: "Window not found: :1".
I've tried to change to bind-key -n F1 select-window -t remote:1
, the error message is similar: "Window not found: remote:1".
Switching windows from command line works, both tmux select-window -t :1
and tmux select-window -t remote:1
.
How can I make it work as a key binding?
tmux list-windows
show? Do you havebase-index
set to a high value (so that you do not normally have a window with an index as low as 1)?tmux list-windows
shows1: bash* (1 panes) [108x48] [layout ce7d,108x48,0,0,0] @0 (active)
.base-index
is set to 1 in~/.tmux.conf
.