diff options
| author | Eugene Triguba <eugenetriguba@gmail.com> | 2025-07-05 00:01:13 -0400 |
|---|---|---|
| committer | Eugene Triguba <eugenetriguba@gmail.com> | 2025-07-05 00:01:13 -0400 |
| commit | f7ec5b64aec5d949271e0e925a03d5de556ca5c7 (patch) | |
| tree | 66377bc6bb9f35a53b5d1a6e081f123503c1e03b /executables/bin | |
| parent | update brewfile (diff) | |
| download | dotfiles-f7ec5b64aec5d949271e0e925a03d5de556ca5c7.zip | |
Replace neovim toggle term w/ tmux term
Diffstat (limited to 'executables/bin')
| -rwxr-xr-x | executables/bin/tmux-toggle-term | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/executables/bin/tmux-toggle-term b/executables/bin/tmux-toggle-term new file mode 100755 index 0000000..7012392 --- /dev/null +++ b/executables/bin/tmux-toggle-term @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +set -uo pipefail +FLOAT_TERM="${1:-}" +LIST_PANES="$(tmux list-panes -F '#F')" +PANE_ZOOMED="$(echo "${LIST_PANES}" | grep Z)" +PANE_COUNT="$(echo "${LIST_PANES}" | wc -l | bc)" +if [ -n "${FLOAT_TERM}" ]; then + if [ "$(tmux display-message -p -F "#{session_name}")" = "popup" ]; then + tmux detach-client + else + tmux popup -d '#{pane_current_path}' -xC -yC -w90% -h80% -E "tmux attach -t popup || tmux new -s popup" + fi +else + if [ "${PANE_COUNT}" = 1 ]; then + tmux split-window -c "#{pane_current_path}" + elif [ -n "${PANE_ZOOMED}" ]; then + tmux select-pane -t:.- + else + tmux resize-pane -Z -t1 + fi +fi |