# tmux.conf
# SETUP_LOAD: source "DOTFILES_DIR/tmux.conf"

run-shell 'tmux set -g status-right "${USER}@`hostname` | `tmux -V` "'

run-shell 'tmux set -g status-bg "$_HOSTCOLOR_1" >/dev/null'
run-shell 'tmux set -g status-fg "$_HOSTCOLOR_2" >/dev/null'
run-shell 'tmux set -g mode-bg "$_HOSTCOLOR_1" >/dev/null'
run-shell 'tmux set -g mode-fg "$_HOSTCOLOR_2" >/dev/null'
run-shell 'tmux set -g pane-active-border-fg "$_HOSTCOLOR_1" >/dev/null'

unbind C-b
set -g prefix C-z

bind C-z send-prefix
bind C-c command-prompt "new-window '%%'"
bind C-r source-file ~/.tmux.conf \; display-message "Reloaded config !"
# new-session: -A: "behaves like attach-session if session-name already exists"
#              -d: do not attach the created session
bind C-o command-prompt -p "session name to switch to:" \
    "new-session -Ad -s '%1'\; switch-client -t '%1'"

set -g base-index 1
set -g pane-base-index 1
set -g renumber-windows off
setw -g mode-keys vi
#setw -g mode-mouse off
#set -g default-command /bin/bash

# Use pasteboard on MacOS
run-shell 'test "`uname`" = Darwin && tmux bind-key -T copy-mode-vi "Enter" send-keys -X copy-pipe-and-cancel "pbcopy"'
run-shell 'test "`uname`" = Darwin && tmux bind-key "]" run "pbpaste | tmux load-buffer - && tmux paste-buffer"'

#set -g default-path "$HOME"

# try to set title of terminal tmux is running on
# set -g set-titles off
set -g display-panes-time 5000
# <Index>|<Command>:<Title><Window flag>
# Example: `1|emacs:.dotfiles*`
set -g window-status-current-format "#I|#{pane_current_command}:#T#F"
set -g window-status-format "#I|#{pane_current_command}:#T#F"
# set window name automatically from command currently running
set -g automatic-rename on

# disable updating status-left and status-right
set -g status-interval 0
set -g status-keys emacs

set -g message-bg white
set -g message-fg black
setw -g window-status-current-bg white
setw -g window-status-current-fg black
#setw -g window-status-attr bold