0

I added the tmux plugin to my .zshrc file.  When I try to make it run on startup with TMUX_AUTOSTART=true, it just shows the terminal window and disappears in under a second.  Then I open it again and I can work.  Again after a while if I close the terminal and try to run it again it might happen, or it might run correctly and let me work.  This is getting really annoying.  When I try other code to run tmux on start up, like these:

if command -v tmux &> /dev/null && [ -n "$PS1" ] && [[ ! "$TERM" =~ screen ]] && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ]; then exec tmux fi 

or

[[ $- != *i* ]] && return [[ -z "$TMUX" ]] && exec tmux 

or

[ -z "$TMUX" ] && { tmux attach || exec tmux new-session && exit;} 

or any other code, the terminal just opens up and closes itself in under a second, forever.  After that, it closes every time.

3 Answers 3

2

You have to put your ZSH_TMUX_AUTOSTART between your plugins and your oh-my-zsh source.

Like this:

plugins=(tmux)

ZSH_TMUX_AUTOSTART=true

source $ZSH/oh-my-zsh.sh

1
  • that's exactly where it is already Commented Jul 18, 2020 at 15:05
0

I had the same problem and I solved it by adding:

[ -z "$TMUX" ] && { tmux attach || exec tmux new-session && exit; } 

To the very top of my .zshrc, not below anything.

0
ZSH_TMUX_AUTOCONNECT=false 

worked for me

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.