Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 284
dmonopoly Avatar asked Apr 19 '14 04:04

dmonopoly


2 Answers

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).
like image 179
jasonwryan Avatar answered Oct 22 '22 18:10

jasonwryan


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.

like image 38
LucasB Avatar answered Oct 22 '22 17:10

LucasB