# tpm install:  git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-sidebar'
set -g @plugin 'tmux-plugins/tmux-pain-control'

set -g @plugin 'tmux-plugins/tmux-logging'

set -g @plugin 'tmux-plugins/tmux-copycat'


# https://github.com/tmux-plugins/tmux-resurrect
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @resurrect-capture-pane-contents 'on'
set -g @resurrect-processes 'ssh neomutt mbsync'
# https://github.com/tmux-plugins/tmux-continuum
set -g @plugin 'tmux-plugins/tmux-continuum'

set -g @plugin 'seebi/tmux-colors-solarized'

# too wild, some shortcuts like meta-tab/meta-number are nice though
# set -g @plugin 'ek9/tmux-vim-bindings'

# set -g @colors-solarized '256'
# set -g @colors-solarized 'light'
set -g @colors-solarized 'dark'


# Change prefix to C-a
# C-a hex value: 0x01
set -g prefix C-a
unbind C-b
bind C-a send-prefix

# vi copy mode
set -g mode-keys vi
bind Escape copy-mode
# unbind p
# 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 'c-v' send-keys -X rectangle-toggle

# bind-key -n is a shortcut for -T root (table for keys without prefix)
bind-key -n M-1 select-window -t 1
bind-key -n M-2 select-window -t 2
bind-key -n M-3 select-window -t 3
bind-key -n M-4 select-window -t 4
bind-key -n M-5 select-window -t 5
bind-key -n M-6 select-window -t 6
bind-key -n M-7 select-window -t 7
bind-key -n M-8 select-window -t 8
bind-key -n M-9 select-window -t 9
bind-key -n M-0 select-window -t 10
bind-key -n M-- last-window

# Number windows and panes starting at 1 so that we can jump to
# them easier.
set -g base-index 1
set -g pane-base-index 1

# 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'

# workaround for 24bit colors for vim in tmux
# tip from https://github.com/vim/vim/issues/3608
set -ag terminal-overrides ",xterm-256color:Tc"

# synchronize panes
bind e setw synchronize-panes ; display "Sync #{?pane_synchronized,ON,OFF}"


# tpm install:  git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
