From 31b73808b4fd18f6082576820acbb11a1a867bde Mon Sep 17 00:00:00 2001 From: Simon Gomizelj Date: Sun, 4 Dec 2011 12:10:32 -0500 Subject: [PATCH] If cmd isn't specified in either the zstyle or $2, default to $SHELL. If dir is set, change the directory prior to starting tmux to change the working directory. --- plugins/tmux/tmux.plugin.zsh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 6d7252e61..12672a68e 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -34,16 +34,17 @@ if (( $+commands[tmux] )); then t() { # Load the command or directory-path from config. - zstyle -a :omz:plugins:tmux:cmd $1 cmd + zstyle -a :omz:plugins:tmux:cmd $1 cmd; cmd=${cmd:-$2} zstyle -a :omz:plugins:tmux:dir $1 dir - (( $+commands[$cmd] )) || [[ -d $dir ]] || return 127 + [[ -n $cmd ]] && (( ! $+commands[$cmd] )) && return 127 # start the command # if ! tmux has -t $1 2>/dev/null; then if ! tmux has -t $1; then - # It would be nice to hide the message about set changing the default-path. - [[ -d $dir ]] && (cd $dir && tmux new -s $1 \; set default-path ${dir}) - (( $+commands[$cmd] )) && TMUX= tmux new -ds $1 ${cmd-$2} + ( + [[ -d $dir ]] && cd $dir + TMUX= tmux new -ds $1 ${cmd:-$SHELL} + ) fi # switch or attach depending on if we're inside tmux