diff --git a/.dfminstall b/.dfminstall index c1ba772..ffe2ffd 100644 --- a/.dfminstall +++ b/.dfminstall @@ -1,6 +1,8 @@ bin recurse .config recurse + bin/dfm chmod 0755 +.tmux/zoom 0755 README.md skip aliases skip diff --git a/.tmux.conf b/.tmux.conf index 3cf2602..ac5a171 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -145,3 +145,5 @@ bind r source-file ~/.tmux.conf #set-option -g status-right '#[fg=white,nobright][ #[fg=black,bright]#(uptime | rev | cut -d":" -f1 | rev | sed s/,//g )#[fg=white,nobright] ]' +# Setup 'x' zoom into a panes (maximize) an save/restore other panes in the current window +bind x run ". ~/.tmux/zoom" diff --git a/.tmux/zoom b/.tmux/zoom new file mode 100755 index 0000000..ddf3750 --- /dev/null +++ b/.tmux/zoom @@ -0,0 +1,21 @@ +#!/bin/bash -f +currentwindow=`tmux list-window | tr '\t' ' ' | sed -n -e '/(active)/s/^[^:]*: *\([^ ]*\) .*/\1/gp'`; +currentpane=`tmux list-panes | sed -n -e '/(active)/s/^\([^:]*\):.*/\1/gp'`; +panecount=`tmux list-panes | wc | sed -e 's/^ *//g' -e 's/ .*$//g'`; +inzoom=`echo $currentwindow | sed -n -e '/^zoom/p'`; +if [ $panecount -ne 1 ]; then + inzoom=""; +fi +if [ $inzoom ]; then + lastpane=`echo $currentwindow | rev | cut -f 1 -d '@' | rev`; + lastwindow=`echo $currentwindow | cut -f 2- -d '@' | rev | cut -f 2- -d '@' | rev`; + tmux select-window -t $lastwindow; + tmux select-pane -t $lastpane; + tmux swap-pane -s $currentwindow; + tmux kill-window -t $currentwindow; +else + newwindowname=zoom@$currentwindow@$currentpane; + tmux new-window -d -n $newwindowname; + tmux swap-pane -s $newwindowname; + tmux select-window -t $newwindowname; +fi