Skip to content

Instantly share code, notes, and snippets.

@stphn
Last active November 26, 2023 10:24
Show Gist options
  • Save stphn/0ed6a920470e68ee6f5bca8d8a8a56ca to your computer and use it in GitHub Desktop.
Save stphn/0ed6a920470e68ee6f5bca8d8a8a56ca to your computer and use it in GitHub Desktop.
// TMUX
C-a C-o Rotate through the panes
C-a C-z Suspend the current client
C-a Space Select next layout
C-a ! Break pane to a new window
C-a # List all paste buffers
C-a $ Rename current session
C-a & Kill current window
C-a ' Prompt for window index to select
C-a ( Switch to previous client
C-a ) Switch to next client
C-a , Rename current window
C-a . Move the current window
C-a / Describe key binding
C-a 0 Select window 0
C-a 1 Select window 1
C-a 2 Select window 2
C-a 3 Select window 3
C-a 4 Select window 4
C-a 5 Select window 5
C-a 6 Select window 6
C-a 7 Select window 7
C-a 8 Select window 8
C-a 9 Select window 9
C-a : Prompt for a command
C-a ; Move to the previously active pane
C-a = Choose a paste buffer from a list
C-a ? List key bindings
C-a C Customize options
C-a D Choose a client from a list
C-a E Spread panes out evenly
C-a L Switch to the last client
C-a M Clear the marked pane
C-a [ Enter copy mode
C-a ] Paste the most recent paste buffer
C-a c Create a new window
C-a d Detach the current client
C-a f Search for a pane
C-a i Display window information
C-a n Select the next window
C-a o Select the next pane
C-a p Select the previous window
C-a q Display pane numbers
C-a s Choose a session from a list
C-a t Show a clock
C-a w Choose a window from a list
C-a x Kill the active pane
C-a z Zoom the active pane
C-a { Swap the active pane with the pane above
C-a } Swap the active pane with the pane below
C-a ~ Show messages
C-a DC Reset so the visible part of the window follows the cursor
C-a PPage Enter copy mode and scroll up
C-a Up Select the pane above the active pane
C-a Down Select the pane below the active pane
C-a Left Select the pane to the left of the active pane
C-a Right Select the pane to the right of the active pane
C-a M-1 Set the even-horizontal layout
C-a M-2 Set the even-vertical layout
C-a M-3 Set the main-horizontal layout
C-a M-4 Set the main-vertical layout
C-a M-5 Select the tiled layout
C-a M-n Select the next window with an alert
C-a M-o Rotate through the panes in reverse
C-a M-p Select the previous window with an alert
C-a M-Up Resize the pane up by 5
C-a M-Down Resize the pane down by 5
C-a M-Left Resize the pane left by 5
C-a M-Right Resize the pane right by 5
C-a C-Up Resize the pane up
C-a C-Down Resize the pane down
C-a C-Left Resize the pane left
C-a C-Right Resize the pane right
C-a S-Up Move the visible part of the window up
C-a S-Down Move the visible part of the window down
C-a S-Left Move the visible part of the window left
C-a S-Right Move the visible part of the window right
// .tmux.conf
set -g default-terminal "screen-256color"
set-option -sg escape-time 10
set -g prefix C-a
unbind C-b
bind-key C-a send-prefix
unbind %
bind | split-window -h
unbind '"'
bind - split-window -v
# easier refresh tmux config
unbind r
bind r source-file ~/.tmux.conf
# keybinds for resize-pane
bind -r j resize-pane -D 5
bind -r k resize-pane -U 5
bind -r l resize-pane -R 5
bind -r h resize-pane -L 5
# keybind for maximize pane and minimize pane
bind -r m resize-pane -Z
# enable mouse in tmux
set -g mouse on
# Configure vim movements for tmux’s copy mode
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi 'v' send -X begin-selection # start selecting text with "v"
bind-key -T copy-mode-vi 'y' send -X copy-selection # copy text with "y"
unbind -T copy-mode-vi MouseDragEnd1Pane # don't exit copy mode after dragging with mouse
# Custom design
#set -g status-bg colour
#set -g status-fg colour35
# Add and configure tmux plugins with tpm
# tpm plugin
set -g @plugin 'tmux-plugins/tpm'
# list of tmux plugins
set -g @plugin 'christoomey/vim-tmux-navigator' # for navigating panes and vim/nvim with Ctrl-hjkl
#set -g @plugin 'jimeh/tmux-themepack' # to configure tmux theme
set -g @plugin 'tmux-plugins/tmux-resurrect' # persist tmux sessions after computer restart
set -g @plugin 'tmux-plugins/tmux-continuum' # automatically saves sessions for you every 15 minutes
set -g @plugin "janoamaral/tokyo-night-tmux"
#set -g @themepack 'powerline/default/cyan' # use this theme for tmux
set -g @resurrect-capture-pane-contents 'on' # allow tmux-ressurect to capture pane contents
set -g @continuum-restore 'on' # enable tmux-continuum functionality
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment