When making changes to my tmux configuration file in
~/.tmux.conf
,
I have to have tmux reload the changes for them to take effect.
One way to do this is to exit the entire tmux session and start a new one. However, this is often not a desired approach if I am running lots of stuff in my tmux session. So let’s see how we can reload the configuration from within the tmux session.
Reloading tmux configuration without exiting tmux session
Using shell commands
One easy way is to run the shell command:
tmux source-file ~/.tmux.conf
This will will cause tmux to load the specified config file and have the changes take effekt immediately.
Using tmux command mode
An alternative is to use tmux’s command mode.
In order to do that, press Ctrl+B followed by :
to enter command mode.
Then write the comand:
source-file ~/.tmux.conf
Using a key combination
When I am tweaking my config file, I find it a bit awkward to write such a
command every time I need to reload my config file.
I would like to be able to just press Ctrl+B followed by
r
to reload the config.
In order to add such a shortcut, just addd this line to
.tmux.conf
:
bind r source-file ~/.tmux.conf