Skip to content

Instantly share code, notes, and snippets.

@bcawrse
Last active October 29, 2021 16:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bcawrse/d4d2f50584b439e6d4f2ce48c5d33e5d to your computer and use it in GitHub Desktop.
Save bcawrse/d4d2f50584b439e6d4f2ce48c5d33e5d to your computer and use it in GitHub Desktop.
tmux configuration file
## Use vi keys for scrolling etc.
set-window-option -g mode-keys vi
## Do not allow tmux to rename windows
set-option -g allow-rename off
## Extend how long pane #s are displayed
## Useful for `ctrl-b q` # to switch between panes
set -g display-panes-time 4000
## Auto renumbers windows when they are deleted
set -g renumber-windows on
## alternatively, this command will reorder windows
# move-window -r OR movew -r
## copy / paste stuffs
bind P paste-buffer
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-selection
bind-key -T copy-mode-vi v send-keys -X rectangle-toggle
## swap window left / right with ctrl+b Shift_Left & Shift_Right
bind-key -r S-Left swap-window -t -1\; select-window -t -1
bind-key -r S-Right swap-window -t +1\; select-window -t +1
## Don't forget break-pane will break pane into new window and has default bind-key !
## Join windows: <prefix> s, <prefix> j
## USE K INSTEAD OF S BECAUSE OF TMUX RESTORE CONFLICGS
bind-key j command-prompt -p "join pane from:" "join-pane -s '%%'"
bind-key k command-prompt -p "send pane to:" "join-pane -t '%%'"
## More Join / Break pane shortcut details.
## https://unix.stackexchange.com/questions/14300/moving-tmux-pane-to-window#answer-30576
## Need to write some swap-pane shortcuts..
## https://superuser.com/questions/879190/how-does-one-swap-two-panes-in-tmux
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-ressurect'
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'git@github.com:user/plugin'
# set -g #plugin 'git@bitbucket.com:user/plugin'
# Vim-style pane switching
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
## swap to last window with <prefix>+: Shift l
bind-key L last-window
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
## NOTES
# Change starting dir in session
# <prefix>+: attach -c <default-starting-directory>
# Also outside of tmux
# tmux attach-session -t <session> -c <default-starting-directory>
# Reload tmux conf
# <prefix>+: source-file ~/.tmux.conf
# Also outside of tmux
# tmux source-file ~/.tmux.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment