set -s escape-time 0

# replace default prefix and bind-key
unbind C-b
set-option -g prefix C-Space
bind-key C-Space send-prefix

# settings for status line and window list
set-option -g base-index 1
set-option -g status-position 'bottom'
set-option -g status-left-length 28
set-option -Fg status-right '#{host} | %Y-%m-%d %H:%M' # or maybe host_short

# theme settings
set-option -g status-style "bg=default fg=default" # default, theme files can overwrite
source-file "$XDG_CONFIG_HOME/tmux/theme.conf"

# unbind keys
unbind-key f; unbind-key C-f; unbind-key s; unbind-key C-s
unbind-key c; unbind-key n; unbind-key p
unbind-key q; unbind-key w
unbind-key C-o; unbind-key C-n; unbind-key C-p; unbind-key C-l; unbind-key C-h
unbind-key 0

# vim-like movement stuff
set-window-option -g mode-keys vi
bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
bind -r k select-pane -U
bind -r j select-pane -D
bind -r h select-pane -L
bind -r l select-pane -R

# reload tmux.conf
bind-key r source-file "$XDG_CONFIG_HOME/tmux/tmux.conf" \; display-message "tmux.conf reloaded"

# closing the current session
bind-key q kill-session
bind-key w run-shell "$DIR_SCRIPTS/tmux-session-close #{session_name}"

# creating new windows
bind-key n new-window

# find and switching for sessions, include using tmux-session-init
bind-key C-f run-shell "tmux neww $DIR_SCRIPTS/tmux-session-init"
bind-key C-s choose-session
bind-key S choose-window
bind-key C-h run-shell "tmux neww $DIR_SCRIPTS/tmux-session-init hub"
bind-key C-j run-shell "tmux neww $DIR_SCRIPTS/tmux-session-init notes" \; switch-client -t "notes:2"
bind-key -r C-l switch-client -l
bind-key -r C-o last-window
bind-key -r C-n next-window
bind-key -r C-p previous-window
bind-key 0 select-window -t 10

