Is it possible to configure tmux so that when you want to switch to a window that doesn't exist, it creates the window and then switches (avoiding Ctrl-b c) ?


Add this to ~/.tmux.conf:

bind-key 0 if-shell 'tmux select-window -t :0' '' 'new-window -t :0'

This will first attempt to switch to window 0, and if that failed, create it.

Repeat for 1-9.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.