#tmux conf by Paramah

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

unbind C-b
set -g prefix C-a

unbind l
bind C-a last-window
bind C-p previous-window
bind C-n next-window
bind -n f7 previous-window
bind -n f8 next-window

# Resize bindings (vim like)
bind C-k resize-pane -U
bind C-j resize-pane -D
bind C-h resize-pane -L
bind C-l resize-pane -R

# Change window move behavior
bind . command-prompt "swap-window -t '%%'"
bind > command-prompt "move-window -t '%%'"

bind f command-prompt "resize-pane -Z"
bind n command-prompt "resize-pane"

bind-key a set-window-option synchronize-panes\; display-message "synchronize-panes is now #{?pane_synchronized,on,off}"

unbind %
bind | split-window -h
unbind '"'
bind - split-window -v

# History
set -g history-limit 10000

# Terminal emulator window title
set -g set-titles on
set -g set-titles-string '#S:#I.#P #W'


# clock
set-window-option -g clock-mode-colour colour18 #green

bind b set-window-option synchronize-panes

set -g mouse on

set -g default-terminal "screen-256color"
# Define my custom menu bar
# status bar colors
set -g status-bg colour0
set -g status-fg colour13


# alignment settings
set-option -g status-justify centre

# status left options
set -g status-interval 1

# window list options
# setw -g automatic-rename on
set-window-option -g window-status-format "#[fg=colour0,bg=colour1,nobold,noitalics,nounderscore] #[fg=colour0,bg=colour1,nobold,noitalics,nounderscore]#I#F  #[fg=colour15,bg=colour1,nobold,noitalics,nounderscore]#[fg=colour0,bg=colour1,nobold,noitalics,nounderscore]#W #[fg=colour1,bg=colour0,nobold,noitalics,nounderscore]" 
set-window-option -g window-status-current-format "#[fg=colour0,bg=colour6,nobold,noitalics,nounderscore]#[fg=colour0,bg=colour6,nobold,noitalics,nounderscore]#I#F  #[fg=colour232,bg=colour6,bold,noitalics,nounderscore]#W #[fg=colour6,bg=colour0,nobold,noitalics,nounderscore]"

set-option -ga terminal-overrides ',*:enacs@:smacs@:rmacs@:acsc@'
# Reload tmux conf
bind r source-file ~/.tmux.conf

#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-copycat'
set -g @plugin 'tmux-plugins/tmux-resurrect'
#set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'tmux-plugins/tmux-sessionist'

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

set-option -g status on
set-option -g status-interval 2
set-option -g status-justify "centre"
set-option -g status-left-length 60
set-option -g status-right-length 90
set-option -g status-left "#(~/.tmux/powerline/powerline.sh left)"
set-option -g status-right "#(~/.tmux/powerline/powerline.sh right)"

## set the default TERM
set -g default-terminal screen

## update the TERM variable of terminal emulator when creating a new session or attaching a existing session
set -g update-environment 'DISPLAY SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY TERM'
## determine if we should enable 256-colour support
if "[[ ${TERM} =~ 256color || ${TERM} == fbterm ]]" 'set -g default-terminal screen-256color'

run '~/.tmux/plugins/tpm/tpm'

set -ga terminal-overrides ",xterm-256color:Tc"
