Skip to content

Instantly share code, notes, and snippets.

@raine
Last active May 3, 2020 12:42
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raine/8ca94a1929ff8a8689ab to your computer and use it in GitHub Desktop.
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 =
#!/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
bind-key z run-shell 'tmux-zoom-out-vim'
@boushley
Copy link

It should be noted that line 5 requires Bash 4. If you don't have Bash 4 you'll get an error like

tmux-zoom-out-vim: line 5: ${cmd^^*}: bad substitution

@raine what is the %m in your comparison that you are doing with the cmd variable interpolation. Haven't seen that before and having trouble finding documentation on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment