To reload your tmux configuration without restarting, use: tmux source-file ~/.tmux.conf
from the command line, or from within tmux: Ctrl+b : source-file ~/.tmux.conf
tmux source-file ~/.tmux.conf
After making changes to your tmux configuration file, you need to reload it for the changes to take effect. This can be done without restarting tmux or losing your current sessions and windows.
If you're not currently inside a tmux session, you can reload the configuration using:
$ tmux source-file ~/.tmux.conf
This will apply the configuration to all running sessions.
If you're already inside a tmux session:
source-file ~/.tmux.conf
and press EnterCtrl+b :source-file ~/.tmux.conf
For convenience, add a custom key binding to reload your config. Add this line to your ~/.tmux.conf
:
# Add binding to reload tmux.conf with prefix-r bind r source-file ~/.tmux.conf \; display "Config reloaded!"
With this binding, you can reload your configuration by pressing Ctrl+b r. The \; display "Config reloaded!"
part shows a confirmation message in the tmux status line.
After reloading the configuration, you can verify that your changes were applied:
Ctrl+b :show-options -g
This shows global options. You can also check window-specific options:
Ctrl+b :show-window-options -g
If some changes don't take effect immediately, especially those related to key bindings or layouts, you might need to restart the tmux server:
# Save your sessions first $ tmux kill-server $ tmux
Alternatively, use the tmux-resurrect
plugin to save and restore your sessions before restarting the server.
If you see error messages when reloading, check for syntax errors in your config file:
# Validate tmux.conf syntax $ tmux -f ~/.tmux.conf new-session -d $ echo $? # If exit code is 0, the syntax is valid
Fix any syntax errors in your config file, then try sourcing it again.