setw -g mouse on
set -g default-terminal "xterm-256color"

#history limit
set -g history-limit 10000

#bind `
unbind C-b
set-option -g prefix `
bind ` send-prefix

#reload configuration
bind r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"

bind k send-keys -t.- 'tmux list-keys' Enter

#change color when prefix key is pressed
#set -g status-left '#{?client_prefix,#[bg=colour245 fg=colour233 bold],#[fg=colour155]} (#S)'

#terminal naming and numbering
set -g base-index 1           # start windows numbering at 1
setw -g pane-base-index 1     # make pane numbering consistent with windows
setw -g automatic-rename on   # rename window to reflect current program
set -g renumber-windows on    # renumber windows when a window is closed
set -g set-titles on          # set terminal title'
set -g status-interval 10     # redraw status line every 10 seconds

set -s set-clipboard external

# split current window horizontally
bind - split-window -v
# split current window vertically
bind | split-window -h

# pane navigation
bind -r Left select-pane -L  # move left
bind -r Down select-pane -D  # move down
bind -r Up select-pane -U  # move up
bind -r Right select-pane -R  # move right
bind -r Tab last-window   # cycle thru MRU tabs
# bind { swap pane
# bind } swap pane
# bind z zoom-unzoom pane
#bind > swap-pane -D       # swap current pane with the next one
#bind < swap-pane -U       # swap current pane with the previous one

#copy mode
unbind Space
unbind C-w
#bind M-c copy-mode
bind F5 copy-mode
#bind-key -T copy-mode Space send-keys -X begin-selection
bind-key -T copy-mode s send-keys -X begin-selection
#bind-key -T copy-mode Enter send-keys -X copy-selection-and-cancel "tmux show-buffer | xclip -i"
bind-key -T copy-mode Enter send-keys -X copy-pipe-and-cancel "tmux show-buffer | xclip -selection clipboard"

#selection colors
set-window-option -g mode-style bg=cyan,fg=black

# pane resizing
bind -r C-Left resize-pane -L 2
bind -r C-Down resize-pane -D 2
bind -r C-Up resize-pane -U 2
bind -r C-Right resize-pane -R 2

# Hide status bar on demand
bind C-s if -F '#{s/off//:status}' 'set status off' 'set status on'

# Visual Activity Monitoring between windows
setw -g monitor-activity on
set -g visual-activity on


# status bar theme
  set -g status-fg colour240
  set -g status-bg colour233
  #set -g status-left-bg colour233
  #set -g status-left-fg colour243
  set -g status-left-length 40
  set -g status-left "#{?client_prefix,#[fg=colour255]#[bg=colour31]#[bold] #S #[fg=colour31]#[bg=colour233],#[fg=colour232]#[bg=colour255]#[bold] #S #[fg=colour255]#[bg=colour233]}"

  #set -g status-right-bg colour233
  #set -g status-right-fg colour243
  set -g status-right-length 100
  set -g status-right "#{?pane_in_mode,#[fg=colour232]#[bg=colour202]s select|R rec.toggle|Enter accept|Esc cancel,F5 Copy}#{net_speed} #[fg=colour236,bg=colour233]#[fg=colour255,bg=colour236] %H:%M #[fg=colour233,bg=colour236]#[fg=colour255,bg=colour233,bold] #{session_attached} #[fg=colour255,bg=colour233]#[fg=colour233,bg=colour255] #(whoami)@#[fg=colour232,bg=colour255,bold]#H "

set -g window-status-format "  #I#F  #W  "
set -g window-status-current-format "#[fg=colour233,bg=colour31]#[fg=colour255,bg=colour31][ #I#F:#W] #[fg=colour31,bg=colour233,nobold]"

#popup menu
bind j display-popup -h 80% -w 100% -E "~/scripts/quickterm/qterm"

#set -g window-status-current-bg colour39
#set -g window-status-current-fg colour255

# 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 'github_username/plugin_name#branch'
# set -g @plugin 'git@github.com:user/plugin'
# set -g @plugin 'git@bitbucket.com:user/plugin'
set -g @plugin 'jaclu/tmux-menus'

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
