# prefix Control + T
#set-option -g prefix C-t

set-option -sg escape-time 9

# 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

#bind -n C-d detach

# Enable mouse mode (tmux 2.1 and above)
#set -g mouse on

bind-key -n -T copy-mode-vi Enter send-keys -X copy-pipe 'xclip -i -sel p -f | xclip -i -sel c'
bind-key -n -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe 'xclip -i -sel p -f | xclip -i -sel c'

# only this line might not be enough
set -g default-terminal "tmux-256color"
# Needs this line also to overrides the default color
set-option -ga terminal-overrides ",xterm-256color:Tc"

######################
### DESIGN CHANGES ###
######################

# panes
set -g pane-border-style fg=black
set -g pane-active-border-style fg=brightred

## Status bar design
# status line
set -g status-justify left
set -g status-style bg=default,fg=colour12
set -g status-interval 5

# messaging
set -g message-style bg=yellow,fg=black
set -g message-command-style bg=black,fg=blue

#window mode
setw -g mode-style bg=colour6,fg=colour0

# window status
setw -g window-status-format " #F#I:#W#F "
setw -g window-status-current-format " #F#I:#W#F "
setw -g window-status-format "#[fg=magenta]#[bg=black] #I #[bg=cyan]#[fg=colour8] #W "
setw -g window-status-current-format "#[bg=brightmagenta]#[fg=colour8] #I #[fg=colour8]#[bg=colour14] #W "
setw -g window-status-current-style bg=colour0,fg=colour11,dim
setw -g window-status-style bg=green,fg=black,reverse

# Info on left (I don't have a session display for now)
set -g status-left ''

# loud or quiet?
set-option -g visual-activity off
set-option -g visual-bell off
set-option -g visual-silence off
set-window-option -g monitor-activity off
set-option -g bell-action none

set -g default-terminal "screen-256color"

# The modes
setw -g clock-mode-colour colour135
setw -g mode-style fg=colour196,bg=colour238,bold

# The panes

set -g pane-border-style bg=colour235,fg=colour238
set -g pane-active-border-style bg=colour236,fg=colour51

# The statusbar

set-option -g status-position top
set -g status-style bg=colour234,fg=colour137,dim
set -g status-left ''
set -g status-right '#[fg=colour233,bold] #{load_full} #[fg=colour233,bg=colour245,bold] %H:%M '
set -g status-right-length 50
set -g status-left-length 20

setw -g window-status-current-style bg=colour238,fg=colour81,bold
setw -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour255]#W#[fg=colour50]#F '

setw -g window-status-style bg=colour235,fg=colour138
#setw -g window-status-attr none
setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '

setw -g window-status-bell-style bg=colour1,fg=colour255,bold

# The messages

set -g message-style bg=colour166,fg=colour232,bold

# List of 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'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-pain-control'
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'tmux-plugins/tmux-open'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @plugin 'jamesoff/tmux-loadavg'


# Initialize TMUX plugin manager
run '~/.tmux/plugins/tpm/tpm'
if '[ -f ~/.tmux.conf.local ]' 'source ~/.tmux.conf.local'

