Last active
May 3, 2020 12:42
-
-
Save raine/8ca94a1929ff8a8689ab to your computer and use it in GitHub Desktop.
tmux+vim: zoom into pane and resize windows to equal size in vim with CTRL-W =
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
cmd="$(tmux display -p '#{pane_current_command}')" | |
cmd="$(basename "${cmd,,*}")" | |
tmux resize-pane -Z | |
if [ "${cmd%m}" = "vi" ]; then | |
sleep 0.1 | |
tmux send-keys C-w = | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bind-key z run-shell 'tmux-zoom-out-vim' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It should be noted that line 5 requires Bash 4. If you don't have Bash 4 you'll get an error like
@raine what is the
%m
in your comparison that you are doing with thecmd
variable interpolation. Haven't seen that before and having trouble finding documentation on it.