DEV Community

Play Button Pause Button
Waylon Walker
Waylon Walker

Posted on • Originally published at waylonwalker.com

Faster config updates with tmux source-file

So you have been tricking out that .tmux.conf, you're looking for a silky
smooth workflow that lets you fly through tmux with super speed, but every time
you tweak out that .tmux.conf you have to restart your whole session. Not amymore,

Let's add this to the bottom of our tmux.conf so that you can see everytime it
gets sourced.

display-message "hello beautiful"
Enter fullscreen mode Exit fullscreen mode

command

We can run this command from your shell to re-source your changed .tmux.conf

tmux source-file ~/.tmux.conf
Enter fullscreen mode Exit fullscreen mode

It also works from the tmux command line.

source-file ~/.tmux.conf
Enter fullscreen mode Exit fullscreen mode

tmux hotkey

It's very common to set this up as a keybinding so that you can do it easily
without needing to memorize the exact command.

bind -T prefix r source-file ~/.tmux.conf
bind -n M-r source-file ~/.tmux.conf
Enter fullscreen mode Exit fullscreen mode

from vim

This is my preferred way of re-sourcing my .tmux.conf. It sits quietly in
the background, and I dont need to remember to do anything. If you are a vim
user you can automate this process by creating a autocmd bufwritepost. This
will shell out the tmux source-file everytime you save your .tmux.conf.

autocmd bufwritepost .tmux.conf execute ':!tmux source-file %'
autocmd bufwritepost .tmux.local.conf execute ':!tmux source-file %'
Enter fullscreen mode Exit fullscreen mode

Be sure to check out the full YouTube playlist and subscribe if you like it.

tmux playlist on youtub

Also check out this long form post for more about how I use tmux.

Top comments (0)