Skip to content

Instantly share code, notes, and snippets.

@jmoyers
Last active June 16, 2021 00:30
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jmoyers/101302f09632df908d84b3f79d7d54aa to your computer and use it in GitHub Desktop.
Save jmoyers/101302f09632df908d84b3f79d7d54aa to your computer and use it in GitHub Desktop.
# remap C-b to C-a
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# reload the conf file on the fly
bind r source-file ~/.tmux.conf
# who knows what this does, but I can now scroll in a tmux pane
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
set -g mode-mouse on
# repeat last shell command on right pane (if it happens to be a shell)
bind-key s select-pane -t 1 \; send-keys C-c Up C-m \; last-pane
# swap right pane in window 0 with default pane in window 1
#
# make sure our current window is listed as 0
# create a second window if it doesn't exist
# select our 0 window again in case we created a new one
# select our second pane in 0 window
# join that pane to window 1
# select the pane above the one we just moved there
# move that pane to window 0
# send the up arrow and enter to that pane (run last shell command)
# switch to last pane, which will be window 0, pane 0 (primary left)
# make sure we are horiontal-even
# redraw vim -- since it gets fucked up in this build when selecting
# layout programmatically. This whole thing assumes vim in left pane.
bind-key d \
if-shell 'tmux select-window -t :0' '' 'move-window -t :0' \; \
if-shell 'test $(tmux list-panes | wc -l) -gt 1' '' 'split-window -h' \; \
if-shell 'tmux select-window -t :1' '' 'new-window' \; \
select-window -t 0 \; \
select-pane -t 1 \; \
join-pane -t 1.0 \; \
select-pane -U \; \
join-pane -h -t 0.0 \; \
last-pane
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment