Skip to content

Instantly share code, notes, and snippets.

@PolyMMA
Last active August 19, 2022 15:22
Show Gist options
  • Save PolyMMA/2c70f1f12393a75df0c9ae077a985cdd to your computer and use it in GitHub Desktop.
Save PolyMMA/2c70f1f12393a75df0c9ae077a985cdd to your computer and use it in GitHub Desktop.
My tmux configuration
## My TMUX configuration file
## by: PolyMMA
##
## Plugin manager can be found here: https://github.com/tmux-plugins/tpm
## First time install:
## 1. git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
## 2. tmux source-file ~/.tmux.conf
## 3. Inside tmux: 'prefix + I' to install
##
## For any additional changes run the follwing inside tmux
## tmux source-file ~/.tmux.conf
##
##
# Store and restore sessions
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
## Start continuum on boot
set -g @gontinuum-boot 'on'
## Restore Vim sessions
set -g @resurrect-strategy-vim 'session'
## Restore Neovim sessions
set -g @resurrect-strategy-nvim 'session'
## Restore Panes
set -g @resurrect-capture-pane-contents 'on'
## Restore last saved environment (automatically)
set -g @continuum-restore 'on'
# Improve colors
set -g default-terminal "xterm-256color"
# set -g default-terminal 'screen-256color'
# Scrollback buffer to 10 000 lines
set -g history-limit 10000
# Set time to switch panes with C-b q #
set -g display-panes-time 4000
# Customize the status line
set -g status-fg green
set -g status-bg black
# Mouse use
set -g mouse on
# set mode-keys (to vim)
set -g mode-keys vi
## Bind keys
# Copy/paste
bind-key -T copy-mode-vi 'r' send -X rectangle-toggle
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
# Navigate panes using vims hjkl
bind-key -r -T prefix 'k' select-pane -U
bind-key -r -T prefix 'j' select-pane -D
bind-key -r -T prefix 'h' select-pane -L
bind-key -r -T prefix 'l' select-pane -R
# swap between last window
bind-key C-l last-window
# give input to all visible panes (toggle)
bind-key C-a set-window-option synchronize-panes\; display-message "synchronize-panes is now #{?pane_synchronized,on,off}"
# Set up copy to system clipboard
# NOTE: Make sure you have "xclip" installed!!!
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -i -f -selection primary | xclip -i -selection clipboard"
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe "xclip -i -f -selection primary | xclip -i -selection clipboard"
bind -T copy-mode-vi C-j send-keys -X copy-pipe-and-cancel "xclip -i -f -selection primary | xclip -i -selection clipboard"
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
# 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'
# 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