# Plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-yank'

# Remap prefix to Control + space
set -g prefix C-space
bind C-space send-prefix

# Keep plenty of history for scrollback
set -g history-limit 10000

# Upgrade colors
set -g default-terminal "screen-256color"

# Remove delay for entering copy mode
set-option -sg escape-time 0

# Horizontal and vertical splits
bind \\ split-window -h -c '#{pane_current_path}'
bind - split-window -v -c '#{pane_current_path}'

# Smart pane switching with awareness of vim splits
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R"
bind -n C-\\ run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys 'C-\\') || tmux select-pane -l"

# Status bar
set -g status-interval 2
set -g status-right-length 59
set -g renumber-windows on
set-option -g base-index 1
set-window-option -g pane-base-index 1

set-option -g status-position bottom


# Copy mode works as Vim
bind Escape copy-mode
bind C-[ copy-mode
bind p paste-buffer

# Enable mouse mode
set -g mouse on