dotfiles/zsh/modules/tmux/init.zsh
James Patrick 3b54637ca7 Adding basic zsh configuration.
At this point the following doesn't work.

- prompt
- history
- most autocomplete

Additionally with the tmux script getting loaded zplug we are getting a double
render issue, which is increasing the start up time. I'll probably move this
before the .zshrc set to short circuit having to set up all zplug script twice
before having a useable shell.
2019-04-30 23:29:37 -04:00

29 lines
839 B
Bash

# vim: syn=zsh
# Return if tmux isn't installed.
if (( ! $+commands[tmux] )); then
return 1
fi
# If this this terminal meets any of these return.
env_array=($TMUX $EMACS $VIM $INSODE_EMACS $VSCODE)
if [[ -n $env_array ]]; then
return 0
fi
if ( [[ -n "$SSH_TTY" ]] && zstyle -t ':tmux:auto-start' remote ) || \
( [[ -z "$SSH_TTY" ]] && zstyle -t ':tmux:auto-start' local ) \
; then
zstyle -s ':tmux:auto-start' name tmux_session
tmux_session=${tmux_session:-tmux}
echo $tmux_session
tmux start-server
if ! tmux has-session 2> /dev/null; then
zstyle -s ':tmux:auto-start' name tmux_session
tmux \
new-session -d -s "${tmux_session:-tmux}" \; \
set-option -t "${tmux_session:-tmux}" destroy-unattached off &> /dev/null
fi
tmux attach -t $tmux_session
fi