I’m trying to make a function in tmux so that when desired, I can bring up the command prompt (Ctrl-B, 🙂 and type this in and have tmux spawn a new window in my existing session with a number of panes running a few specific commands.
Is this possible?
How about something like this:
Create a file called
~/foo.confWe’ll use
newwto create the new window, then we’ll issue commands to that new window.Using
C-msends the Enter key so the command executes. You couldalso pass the command to
newwdirectly.Then in your
~/.tmux.conf, bind it to a keyThis is just one way to pull this off. This particular scenario names the window, but with a little ingenuity, I’m sure you can come up with a workaround for that.
Every tmux command can be issued from the .conf files, and can also be issued by passing it to
tmuxitself.Hope that helps!