tmux: Setup 'x' zoom into a panes (maximize) an save/restore other panes in the current window
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
bin recurse
|
||||
.config recurse
|
||||
|
||||
bin/dfm chmod 0755
|
||||
.tmux/zoom 0755
|
||||
|
||||
README.md skip
|
||||
aliases skip
|
||||
|
||||
@@ -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"
|
||||
|
||||
21
.tmux/zoom
Executable file
21
.tmux/zoom
Executable 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
|
||||
Reference in New Issue
Block a user