Skip to content

Instantly share code, notes, and snippets.

@frenata
Last active May 1, 2025 13:04
Show Gist options
  • Save frenata/d5150712adbe5d4928361f6a991cc1f9 to your computer and use it in GitHub Desktop.
Save frenata/d5150712adbe5d4928361f6a991cc1f9 to your computer and use it in GitHub Desktop.
set -g default-terminal "screen-256color"
# keybindings
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
# Change the 'leader' key (the prefix by which you 'command' tmux itself rather than type)
# -- I hate pressing ctrl all the time, so instead I remap this to the ` key.
# Basically for all tmux commands, now type ` followed by the command.
unbind C-b
set-option -g prefix `
bind-key ` send-prefix
bind r source-file ~/.tmux.conf
# Because - and | 'look like' splitting the window in half various ways.
bind | split-window -h
bind - split-window -v
# Use the arrow keys to move between panes.
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
bind l select-pane -R
bind h select-pane -L
# This section is entirely for 'nested' tmux -- I don't use it much anymore
# but it's quite useful if you do work on a workstations like a laptop (in tmux of course)
# and then want to ssh into some long-running server (where you *also* want to have persistent sessions)
# To make this work, you only need to copy your .tmux.conf (this file) onto that server
# then you can move back and forth between controlling which level of nesting you're controlling with
# shift+up and shift+down.
bind -n M-F11 set -qg status-bg colour25
bind -n M-F12 set -qg status-bg colour40
bind -n S-up \
send-keys M-F12 \; \
set -qg status-bg colour25 \; \
unbind -n M-Left \; \
unbind -n M-Right \; \
unbind -n M-Up \; \
unbind -n M-Down \; \
set -qg prefix C-b
bind -n S-down \
send-keys M-F11 \; \
set -qg status-bg colour40 \; \
bind -n M-Left select-pane -L \; \
bind -n M-Right select-pane -R \; \
bind -n M-Up select-pane -U \; \
bind -n M-Down select-pane -D \; \
set -qg prefix `
# plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
# set -g @plugin 'tmux-plugins/tmux-resurrect'
# set -g @plugin 'tmux-plugins/tmux-continuum'
# auto restore sessions
# set -g @continuum-restore 'on'
# NOTE: keep at the bottom of the file
# init tmux plugin manager
run -b '~/.tmux/plugins/tpm/tpm'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment