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
  •  | 
  •  

문제

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?

도움이 되었습니까?

해결책

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).

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top