Tmux macro / function
How about something like this:
Create a file named ~/foo.conf
neww -n foo
send-keys -t foo cd ~/ C-m
send-keys -t foo vim C-m
split-window -t foo
We will use neww
to create a new window, then we will output commands to this new window. Usage C-m
sends the Enter key to execute the command. You could also send the command neww
directly.
Then ~/.tmux.conf
bind it to a key
bind z source-file ~/foo.conf
This is just one way to take it off. This particular script calls the window, but with a little ingenuity, I'm sure you can come up with a workaround for this. Each tmux command can be written out from .conf files and can also be issued by passing it on yourself tmux
.
Hope it helps!
source to share