Split pane switching in tmux: switch once per command

That happens because the default bindings for the arrow keys are setup with bind-key -r, specifying that they may be repeated. There are two ways that you can disable this. First, you can use set-option repeat-time 0 to disable repeating entirely. This will affect all bindings. I find that to be very annoying when resizing … Read more

Bash scripts with tmux to launch a 4-paned window

As others have mentioned, your commands are being run by the shell script before launching your $SHELL; there is no general way the instance of $SHELL can know what its parent ran before starting it. To get the “initial command” into the shell history, you need to feed the command keystrokes directly to the instance of … Read more

How to write a shell script that starts tmux session, and then runs a ruby script

#!/bin/bash tmux new-session -d -s my_session ‘ruby run.rb’ Create a file named my_script.sh and give it the above contents. Make the file executable by running: chmod 755 my_script.sh or chmod +x my_script.sh Then run the shell script: ./my_script.sh Making the shell script executable When you perform the chmod 755 filename command you allow everyone to … Read more

How can you tell which pane in Tmux is focused?

Here are the relevant settings: pane-active-border-style fg=colour,bg=colour Set the pane border colour for the currently active pane. So, try adding something like this to your ~/.tmux.conf: set-option -g pane-active-border-style fg=blue That will set a blue border around the active pane. The pane-active-border-style bg=colour option can be used for a more visible solution, as well.

How to auto-update SSH agent environment variables when attaching to existing tmux sessions?

There’s an excellent gist by Martijn Vermaat, which addresses your problem in great depth, although it is intended for screen users, so I’m adjusting it for tmux here. To summarize: create ~/.ssh/rc if it doesn’t exist yet, and add the following content: #!/bin/bash # Fix SSH auth socket location so agent forwarding works with tmux. … Read more