Created
April 27, 2023 15:17
-
-
Save brettbuddin/f9d1b065d89f8333b0c49130f6bfdc6b to your computer and use it in GitHub Desktop.
Stack-based windowing in tmux.
This file contains hidden or 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
# Create new pane in current directory | |
bind -n M-c split-window -b -t :.0 -c "#{pane_current_path}" \;\ | |
select-layout main-vertical \;\ | |
run "tmux resize-pane -t :.0 -x 50%" | |
# Kill pane (only kill if we have more than one pane) | |
TMUX_SHOULD_KILL_PANE="tmux display-message -p '#{window_panes}' | awk '{exit(!($0>1))}'" | |
bind -n M-x if-shell "$TMUX_SHOULD_KILL_PANE" \ | |
"kill-pane -t :." \;\ | |
select-layout main-vertical \;\ | |
run "tmux resize-pane -t :.0 -x 50%" \;\ | |
select-pane -t :.0 | |
# Next pane | |
bind -n M-j select-pane -t :.+ | |
# Prev pane | |
bind -n M-k select-pane -t :.- | |
# Rotate counterclockwise | |
bind -n M-, rotate-window -U \; select-pane -t 0 | |
# Rotate clockwise | |
bind -n M-. rotate-window -D \; select-pane -t 0 | |
# Focus selected pane | |
bind -n M-Space swap-pane -s :. -t :.0 \; select-pane -t :.0 | |
# Refresh layout | |
bind -n M-r select-layout main-vertical \;\ | |
run "tmux resize-pane -t :.0 -x 50%" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment