Skip to content

Instantly share code, notes, and snippets.

@iori-yja
Forked from pi8027/README.mkd
Created October 16, 2012 21:45
Show Gist options
  • Save iori-yja/3902249 to your computer and use it in GitHub Desktop.
Save iori-yja/3902249 to your computer and use it in GitHub Desktop.
bind-key z run pane-maximize
#!/bin/bash
while getopts b: OPT ; do
targetid=$OPTARG
done
currentid=$(tmux display-message -p '#{pane_id}')
tztable=$(tmux showenv tztable | sed "s/^tztable=//")
if [ -n "$targetid" ] ; then
tmux swap-pane -t $targetid -s $currentid \; \
setenv tztable "$tztable:$targetid=$currentid"
echo "******************************"
echo "**** this is a dummy pane ****"
echo "******************************"
while : ; do read ; done
elif targets=$(echo $tztable | sed "s/:/\n/g" | tail -n +2 | grep "^$currentid=") ; then
targetid=$(echo $targets | sed "s/^.*=//" | head -n 1)
tmux swap-pane -t $targetid -s $currentid \; \
kill-pane -t $targetid \; \
setenv tztable "$(echo $tztable | sed "s/:$currentid=[^:]*//")"
else
tmux new-window "$0 -b $currentid"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment