tmux: why do these two lines cause a ".tmux.conf:2: can't establish current session" on startup?

StackOverflow https://stackoverflow.com/questions/23166031

  •  06-07-2023
  •  | 
  •  

Question

I have only these 2 lines in ~/.tmux.conf:

unbind r
bind r source-file ~/.tmux.conf; display "Reloaded"

I start up tmux with just

tmux

And

/Users/.../.tmux.conf:2: can't establish current session

is the result.

Why is this, and how can I prevent it?

Was it helpful?

Solution

You have a typo in the second command; you need to escape the semicolon. See the example in man tmux:

bind-key R source-file ~/.tmux.conf \; \
    display-message "source-file done"

As the manual goes on to explain:

Multiple commands may be specified together as part of a command sequence. Each command should be separated by spaces and a semicolon; commands are executed sequentially from left to right and lines ending with a backslash continue on to the next line, except when escaped by another backslash. A literal semicolon may be included by escaping it with a backslash (for example, when specifying a command sequence to bind-key).

OTHER TIPS

I just had this error message when I had a few set commands in there which didn't have the -g flag. So if someone has that problem, try adding -g to your sets.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top