# Source: https://github.com/lildude/dotfiles/blob/main/chezmoi/dot_config/tmux/tmux.conf
# Licensed under MIT (https://github.com/lildude/dotfiles/blob/main/LICENSE)

# ==========================
# ===  General settings  ===
# ==========================
#
# Some of these borrowed from https://github.com/samoshkin/tmux-config/blob/master/tmux/tmux.conf
#
# Good book: https://leanpub.com/the-tao-of-tmux/read

# utf8 is on
set -g utf8 on
set -g status-utf8 on

# address vim mode switching delay (http://superuser.com/a/252717/65504)
set -s escape-time 0

# Force lotsa colours
set -g default-terminal "screen-256color"

# Start index of window/pane with 1, because we're humans, not computers
set -g base-index 1
setw -g pane-base-index 1

# split panes using | and - cos it's waay more logical than % and "
unbind '"'
unbind %
bind | split-window -h
bind - split-window -v

# reload config file (change file location to your the tmux.conf you want to use)
bind r source-file ~/.tmux.conf

# don't rename windows automatically
set-option -g allow-rename off

# Enable mouse support
# < 2.1
#set -g mode-mouse on
# 2.1 onwards
#set -g mouse on

# =====================================
# ===           Theme               ===
# =====================================

# Feel free to NOT use this variables at all (remove, rename)
# this are named colors, just for convenience
color_orange="colour166" # 208, 166
color_purple="colour134" # 135, 134
color_green="colour076" # 070
color_blue="colour39"
color_yellow="colour220"
color_red="colour160"
color_black="colour232"
color_white="white" # 015

# This is a theme CONTRACT, you are required to define variables below
# Change values, but not remove/rename variables itself
color_dark="$color_black"
color_light="$color_white"
color_session_text="$color_blue"
color_status_text="colour245"
color_main="$color_orange"
color_secondary="$color_purple"
color_level_ok="$color_green"
color_level_warn="$color_yellow"
color_level_stress="$color_red"
color_window_off_indicator="colour088"
color_window_off_status_bg="colour238"
color_window_off_status_current_bg="colour254"

# =====================================
# ===    Appearance and status bar  ===
# ======================================

set -g mode-style "fg=default,bg=$color_main"

# command line style
set -g message-style "fg=$color_main,bg=$color_dark"

# status line style
set -g status-style "fg=$color_status_text,bg=$color_dark"

# window segments in status line
set -g window-status-separator ""

# setw -g window-status-style "fg=$color_status_text,bg=$color_dark"
setw -g window-status-format " #I:#W "
setw -g window-status-current-style "fg=$color_light,bold,bg=$color_main"
setw -g window-status-current-format "#[fg=$color_dark,bg=$color_main] #I:#W #[fg=$color_main,bg=$color_dark]#[default]"

# outline for active pane
setw -g pane-active-border-style "fg=$color_main"

# The left hand side of the status bar
set -g status-left "#[fg=$color_session_text] #S #[default]"

# The right hand side of the status bar
set -g status-right-length 100
set -g status-right "#[fg=$color_orange,bold] #h #[default]#[fg=$color_blue] %d-%b-%y %H:%M %Z"
