28

According to the man page, if I run this command:

tmux source-file ~/.tmux.conf 

tmux is going to execute the commands in ~/.tmux.conf. However if, for example, I add a key binding to tmux.conf, and later remove it, the key binding stays, even if I source the file (which is logical, since there's no actual command to execute for that binding).

So I'm wondering, before sourcing the config, if there a way to somehow clear tmux's internal state (all binding, settings, etc.) so that it starts with the default one?

4
  • 1
    Quit and restart tmux. Commented Jun 26, 2017 at 10:20
  • Sorry for the question, but how do I quit tmux? If I detach all sessions I see it's still running. Do I need to kill the process or is there a clean way to quit it? Commented Jun 26, 2017 at 10:29
  • 1
    tmux will still be running if you detach (that's one of the points of tmux after all). It will exit if all commands (shell sessions usually) that it's managing exits. Commented Jun 26, 2017 at 10:30
  • 4
    In tmux command pane ctrl + b then run, : source-file ~/.tmux.conf Commented Jan 21, 2024 at 7:16

1 Answer 1

25

Changing the tmux configuration and rereading it in an existing tmux session will only change the settings that the configuration file explicitly changes. Removing a key binding from the configuration file, for example, will not unbind that key when you reload the configuration unless you also explicitly unbind it in the configuration.

This is similar to sourcing a shell script with a variable assignment in it; You source it once, which sets the variable, and then you remove it from the file and source it again. This will not remove the shell variable.

The simplest way to reread the configuration file from scratch is to exit tmux and restart it. tmux will exit as soon as all its sessions have ended, which will happen if you, for example, exit all shell sessions from within tmux. You may also issue the tmux command kill-server from within tmux to kill the tmux server and all sessions.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.