Skip to content

Instantly share code, notes, and snippets.

@carolusquintus
Last active August 12, 2023 02:10
Show Gist options
  • Save carolusquintus/cb91e27f961dbe456c4e0b87f7696eb2 to your computer and use it in GitHub Desktop.
Save carolusquintus/cb91e27f961dbe456c4e0b87f7696eb2 to your computer and use it in GitHub Desktop.
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
# switch panes using Alt-arrow without prefix
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
# Enable mouse mode (tmux 2.1 and above)
set -g mouse on
# Enable 256 color
set -g default-terminal "screen-256color"
# Status bar color
set -g status-bg darkcyan
# Status text bar color
set -g status-fg lightgrey
# Inactive window color
set -g window-status-style bg=yellow
# Active window color
set -g window-status-current-style bg=darkmagenta,fg=lightgrey
# don't rename windows automatically
set-option -g allow-rename off
# These bindings are for X Windows only. If you're using a different
# window system you have to replace the `xsel` commands with something
# else. See https://github.com/tmux/tmux/wiki/Clipboard#available-tools
bind -T copy-mode DoubleClick1Pane select-pane \; send -X select-word \; send -X copy-pipe-no-clear "xsel -i"
bind -T copy-mode-vi DoubleClick1Pane select-pane \; send -X select-word \; send -X copy-pipe-no-clear "xsel -i"
bind -n DoubleClick1Pane select-pane \; copy-mode -M \; send -X select-word \; send -X copy-pipe-no-clear "xsel -i"
bind -T copy-mode TripleClick1Pane select-pane \; send -X select-line \; send -X copy-pipe-no-clear "xsel -i"
bind -T copy-mode-vi TripleClick1Pane select-pane \; send -X select-line \; send -X copy-pipe-no-clear "xsel -i"
bind -n TripleClick1Pane select-pane \; copy-mode -M \; send -X select-line \; send -X copy-pipe-no-clear "xsel -i"
bind -n MouseDown2Pane run "tmux set-buffer -b primary_selection \"$(xsel -o)\"; tmux paste-buffer -b primary_selection; tmux delete-buffer -b primary_selection"
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @yank_action 'copy-pipe-no-clear'
bind -T copy-mode C-c send -X copy-pipe-no-clear "xsel -i --clipboard"
bind -T copy-mode-vi C-c send -X copy-pipe-no-clear "xsel -i --clipboard"
# To copy from terminal:
# 1. Ctrl + a + [
# 2. Ctrl + space
# 3. y (yank)
# https://unix.stackexchange.com/questions/58763/copy-text-from-one-tmux-pane-to-another-using-vim
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
run-shell ~/yank/yank.tmux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment