1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-12-18 18:31:59 +00:00

fix(tmux): use $...SESSION_NAME while attaching (#10946)

This commit is contained in:
fedor 2022-12-08 14:38:13 +03:00 committed by GitHub
parent b692ff2e15
commit f4dc8c5be3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -73,7 +73,11 @@ function _zsh_tmux_plugin_run() {
[[ "$ZSH_TMUX_UNICODE" == "true" ]] && tmux_cmd+=(-u) [[ "$ZSH_TMUX_UNICODE" == "true" ]] && tmux_cmd+=(-u)
# Try to connect to an existing session. # Try to connect to an existing session.
[[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach if [[ -n "$ZSH_TMUX_DEFAULT_SESSION_NAME" ]]; then
[[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach -t $ZSH_TMUX_DEFAULT_SESSION_NAME
else
[[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach
fi
# If failed, just run tmux, fixing the TERM variable if requested. # If failed, just run tmux, fixing the TERM variable if requested.
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
@ -83,9 +87,9 @@ function _zsh_tmux_plugin_run() {
tmux_cmd+=(-f "$ZSH_TMUX_CONFIG") tmux_cmd+=(-f "$ZSH_TMUX_CONFIG")
fi fi
if [[ -n "$ZSH_TMUX_DEFAULT_SESSION_NAME" ]]; then if [[ -n "$ZSH_TMUX_DEFAULT_SESSION_NAME" ]]; then
$tmux_cmd new-session -s $ZSH_TMUX_DEFAULT_SESSION_NAME $tmux_cmd new-session -s $ZSH_TMUX_DEFAULT_SESSION_NAME
else else
$tmux_cmd new-session $tmux_cmd new-session
fi fi
fi fi