tmuz 'zooming'

pull/2/head
Bo Jeanes 2012-10-22 23:31:54 -05:00
parent 36748d0634
commit eaca0bc519
3 changed files with 23 additions and 4 deletions

View File

@ -17,7 +17,7 @@ task :install do
misc/ctags
misc/inputrc
misc/nanorc
misc/tmux.conf
misc/tmux/tmux.conf
shells/bash/bash_profile
shells/bash/bashrc
shells/zsh/zshenv

View File

@ -12,10 +12,8 @@ set -g default-terminal "screen-256color"
bind R source-file ~/.tmux.conf
bind \ confirm-before kill-server
unbind Z
bind Z new-window -d -n tmux-zoom 'clear && echo TMUX ZOOM && read' \; swap-pane -s tmux-zoom.0 \; select-window -t tmux-zoom
unbind z
bind z last-window \; swap-pane -s tmux-zoom.0 \; kill-window -t tmux-zoom
bind z run ". ~/.config/misc/tmux/zoom.sh"
# Mouse
setw -g mode-mouse on

21
misc/tmux/zoom.sh 100644
View File

@ -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