unbind C-b
set -g prefix C-s

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

bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"

is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"'
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"

bind-key - split-window -v -c '#{pane_current_path}'
bind-key | split-window -h -c '#{pane_current_path}'
bind c new-window -c "#{pane_current_path}"

set -g base-index 1
set -g renumber-windows on

bind-key b break-pane -d
bind-key C-j choose-tree

# Fine adjustment (1 or 2 cursor cells per bump)
bind -n S-Left  if-shell "$is_vim" "send-keys S-Left"  "resize-pane -L 2"
bind -n S-Right if-shell "$is_vim" "send-keys S-Right" "resize-pane -R 2"
bind -n S-Down  if-shell "$is_vim" "send-keys S-Down"  "resize-pane -D 1"
bind -n S-Up    if-shell "$is_vim" "send-keys S-Up"    "resize-pane -U 1"

# Coarse adjustment (5 or 10 cursor cells per bump)
bind -n C-Left  if-shell "$is_vim" "send-keys C-Left"  "resize-pane -L 10"
bind -n C-Right if-shell "$is_vim" "send-keys C-Right" "resize-pane -R 10"
bind -n C-Down  if-shell "$is_vim" "send-keys C-Down"  "resize-pane -D 5"
bind -n C-Up    if-shell "$is_vim" "send-keys C-Up"    "resize-pane -U 5"

# Use vim keybindings in copy mode
setw -g mode-keys vi

# Setup 'v' to begin selection as in Vim
#bind-key -t vi-copy v begin-selection
#bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"

# Update default binding of `Enter` to also use copy-pipe
#unbind -t vi-copy Enter
#bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"

set-option -g default-terminal "screen-256color"
#source "/home/krichtof/.local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf"

# toggle status bar visibility
if-shell '[ ! -z "$VIMRUNTIME" ]' {
    set -g status off
}

# bind-key u set-option -g status

# List of plugins
# set -g @plugin 'catppuccin/tmux'
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
# set -g @catppuccin_flavor 'latte' # latte,frappe, macchiato or mocha
# 
# # set -g @plugin 'tmux-plugins/tmux-battery'
# set -g @catppuccin_status_modules_right "tmux-pomodoro-plus"


set -g @plugin 'MunifTanjim/tmux-mode-indicator'
set -g @plugin 'olimorris/tmux-pomodoro-plus'
set -g @pomodoro_toggle 'p'                    # Start/pause a Pomodoro/break
set -g @pomodoro_cancel 'P'                    # Cancel the current session
set -g @pomodoro_skip '_'                      # Skip a Pomodoro/break

set -g @pomodoro_mins 25                       # The duration of the Pomodoro
set -g @pomodoro_break_mins 5                  # The duration of the break after the Pomodoro completes
set -g @pomodoro_intervals 4                   # The number of intervals before a longer break is started
set -g @pomodoro_long_break_mins 25            # The duration of the long break
set -g @pomodoro_repeat 'off'                  # Automatically repeat the Pomodoros?
set -g @pomodoro_disable_breaks 'off'          # Turn off breaks

set -g @pomodoro_on ""                      # The formatted output when the Pomodoro is running
set -g @pomodoro_complete " ✔︎"                 # The formatted output when the break is running
set -g @pomodoro_pause " ⏸︎"                    # The formatted output when the Pomodoro/break is paused
set -g @pomodoro_prompt_break " ⏲︎ break?"      # The formatted output when waiting to start a break
set -g @pomodoro_prompt_pomodoro " ⏱︎ start?"   # The formatted output when waiting to start a Pomodoro

set -g @pomodoro_menu_position "R"             # The location of the menu relative to the screen
set -g @pomodoro_sound 'on'                   # Sound for desktop notifications (Run `ls /System/Library/Sounds` for a list of sounds to use on Mac)
set -g @pomodoro_notifications 'on'           # Enable desktop notifications from your terminal
set -g @pomodoro_granularity 'off'             # Enables MM:SS (ex: 00:10) format instead of the default (ex: 1m)

set -g @plugin 'rose-pine/tmux'
set -g @rose_pine_variant 'moon' # Options are 'main', 'moon' or 'dawn'
# set -g @rose_pine_status_right_append_section "#{pomodoro_status}"
# set -g @rose_pine_status_left_prepend_section '#{tmux_mode_indicator}'
set -g @rose_pine_status_right_append_section '#{tmux_mode_indicator}'

set -g @rose_pine_host 'on' # Enables hostname in the status bar
# set -g @rose_pine_date_time '%H:%M' # It accepts the date UNIX command format (man date for info)
set -g @rose_pine_user 'off' # Turn on the username component in the statusbar
set -g @rose_pine_directory 'off' # Turn on the current folder component in the status bar
set -g @rose_pine_bar_bg_disable 'off' # Disables background color, for transparent terminal emulators
# # If @rose_pine_bar_bg_disable is set to 'on', uses the provided value to set the background color
# # It can be any of the on tmux (named colors, 256-color set, `default` or hex colors)
# # See more on http://man.openbsd.org/OpenBSD-current/man1/tmux.1#STYLES
# set -g @rose_pine_bar_bg_disabled_color_option 'default'
# 
set -g @rose_pine_only_windows 'off' # Leaves only the window module, for max focus and space
set -g @rose_pine_disable_active_window_menu 'on' # Disables the menu that shows the active window on the left
# 
# set -g @rose_pine_default_window_behavior 'on' # Forces tmux default window list behaviour
# set -g @rose_pine_show_current_program 'on' # Forces tmux to show the current running program as window name
# set -g @rose_pine_show_pane_directory 'on' # Forces tmux to show the current directory as window name
# Previously set -g @rose_pine_window_tabs_enabled

# Example values for these can be:
set -g @rose_pine_left_separator ' > ' # The strings to use as separators are 1-space padded
set -g @rose_pine_right_separator ' ' # Accepts both normal chars & nerdfont icons
set -g @rose_pine_field_separator ' | ' # Again, 1-space padding, it updates with prefix + I
set -g @rose_pine_window_separator ' - ' # Replaces the default `:` between the window number and name

# These are not padded
set -g @rose_pine_session_icon '' # Changes the default icon to the left of the session name
set -g @rose_pine_current_window_icon '' # Changes the default icon to the left of the active window name
set -g @rose_pine_folder_icon '' # Changes the default icon to the left of the current directory folder
set -g @rose_pine_username_icon '' # Changes the default icon to the right of the hostname
set -g @rose_pine_hostname_icon '󰒋' # Changes the default icon to the right of the hostname
# set -g @rose_pine_date_time_icon '󰃰' # Changes the default icon to the right of the date module
set -g @rose_pine_window_status_separator "  " # Changes the default icon that appears between window names

# Very beta and specific opt-in settings, tested on v3.2a, look at issue #10
# set -g @rose_pine_prioritize_windows 'on' # Disables the right side functionality in a certain window count / terminal width
# set -g @rose_pine_width_to_hide '80' # Specify a terminal width to toggle off most of the right side functionality
# set -g @rose_pine_window_count '5' # Specify a number of windows, if there are more than the number, do the same as width_to_hide

# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'github_username/plugin_name#branch'
# set -g @plugin 'git@github.com:user/plugin'
# set -g @plugin 'git@bitbucket.com:user/plugin'

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
