3 ms·
Here are some things that might be helpful for newcomers. All those tmux commands, like set, bind-key etc might be put inside your tmux.conf file, as well as e
by ludwigvan 11y ago
Here are some things that might be helpful for newcomers.
All those tmux commands, like set, bind-key etc might be put inside your tmux.conf file, as well as executed as commands directly.
For example, once you are inside a tmux session, simply execute them by prefixing with tmux:
tmux set status off
tmux set status on
tmux set status-style "bg=red"
tmux new-window
tmux new-window -n "my window name"
tmux rename-session mysession
Of course, you can execute them outside the tmux session too, you just need to tell it which tmux you want to control.
Open a new terminal, do not enter the tmux session, execute the following:
tmux set -t mysession status-style "bg=yellow"
tmux new-window -t mysession
Inside a tmux session, tmux automatically knows which session you are talking about, so no need for "-t mysession" section.
Now, I hope you get the idea, you can manipulate tmux using a client-server architecture from the outside, this is the gist of the other tools like tmuxinator.
You could easily script tmux this way, so that it sets up 4 windows, one running your server, one running your db etc.
What the keybindings do is, effectively to map these commands to keyboard shortcuts, you can also execute any command using `C-b :`, similar to how emacs can do `M-:`. I think tmux was in some ways inspired by emacs.
Hit `C-b :', then run one of the commands, `new-window`, hit Enter.
When you are satisfied with these commands, move them your .tmux.conf file.
However, note that it will not sourced (read) until after you restart tmux or you source it yourself.
Either quit tmux or do
tmux source ~/.tmux.conf
Of course, you can similarly group your project-level settings to their own configs, and source them or start tmux with those settings with tmux -f.
tmux source myproject.conf (inside tmux session)
or
tmux -f myproject.conf (outside tmux session)