set -g mouse on
set -g default-terminal "tmux-256color"

set -g detach-on-destroy off     # don't exit from tmux when closing a session
set -g escape-time 0             # zero-out escape time delay
set -g history-limit 1000000     # increase history size (from 2,000)
set -g renumber-windows on       # renumber all windows when any window is closed
set -g set-clipboard on          # use system clipboard
set -g base-index 1
set -g pane-base-index 1

#Remove *all* keybindings
unbind-key -a
set -g mode-keys vi

set-option -g prefix ^f

#General
bind ^C new-window
bind ^D detach
bind r command-prompt "rename-window %%"
bind R source-file ~/.config/tmux/tmux.conf
bind : command-prompt
bind ^L send-keys "clear"\; send-keys "Enter"

#Windows
bind w choose-window
bind -n M-H previous-window
bind -n M-L next-window
bind ^A last-window

#Sessions
bind s choose-session

#Panes
bind s split-window -v -c "#{pane_current_path}"
bind v split-window -h -c "#{pane_current_path}"
bind c kill-pane
bind x swap-pane -D
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind z resize-pane -Z
bind -r -T prefix , resize-pane -L 1
bind -r -T prefix . resize-pane -R 1
bind -r -T prefix - resize-pane -D 1
bind -r -T prefix = resize-pane -U 1

#Copy mode
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel

#Plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'catppuccin/tmux'
set -g @plugin 'sainnhe/tmux-fzf'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'christoomey/vim-tmux-navigator'
set -g @plugin 'alexwforsythe/tmux-which-key'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'sainnhe/tmux-fzf'
set -g @plugin 'omerxx/tmux-sessionx'
set -g @plugin 'omerxx/tmux-floax'


#Configure plugins
set -g @floax-width '80%'
set -g @floax-height '80%'
set -g @floax-border-color 'magenta'
set -g @floax-text-color 'blue'
set -g @floax-bind 'p'
set -g @floax-change-path 'true'
set -g @sessionx-bind-zo-new-window 'ctrl-y'
set -g @sessionx-auto-accept 'off'
set -g @sessionx-custom-paths '/Users/omerxx/dotfiles'
set -g @sessionx-bind 'o'
set -g @sessionx-x-path '~/dotfiles'
set -g @sessionx-window-height '85%'
set -g @sessionx-window-width '75%'
set -g @sessionx-zoxide-mode 'on'
set -g @sessionx-custom-paths-subdirectories 'false'
set -g @sessionx-filter-current 'false'
set -g @continuum-restore 'on'
set -g @resurrect-strategy-nvim 'session'

set -g @catppuccin_flavor 'mocha'
set -g @catppuccin_window_status_style 'rounded'
set -g @catppuccin_window_left_separator ""
set -g @catppuccin_window_right_separator " "
set -g @catppuccin_window_middle_separator " █"
set -g @catppuccin_window_number_position "right"
set -g @catppuccin_window_default_fill "number"
set -g @catppuccin_window_default_text "#W"
set -g @catppuccin_window_current_fill "number"
set -g @catppuccin_window_current_text "#W"
set -g @catppuccin_status_modules_right "directory"
set -g @catppuccin_status_left_separator  " "
set -g @catppuccin_status_right_separator ""
set -g @catppuccin_status_right_separator_inverse "no"
set -g @catppuccin_status_fill "icon"
set -g @catppuccin_status_connect_separator "no"
set -g @catppuccin_mode_text ""
set -g @catppuccin_directory_text " #{pane_current_path}"

# source the plugin here
run '~/.tmux/plugins/tpm/tpm'
run '#{TMUX_PLUGIN_MANAGER_PATH}/tmux/catppuccin.tmux'

# set -Fg 'status-format[1]' '#{status-format[0]}'
# set -g 'status-format[0]' ''
# set -g status 2

set -g status-position top
set -g status-interval 1
set -g status-left-length 100
set -g status-right-length 100
set -g status-justify left
set -g status-left ''
set -g status-right " #{?client_prefix,#[fg=#{@thm_red} bold]PREFIX,#{?#{==:#{pane_mode},copy-mode},#[fg=#{@thm_yellow} bold]COPY,#[fg=#{@thm_green} bold]NORMAL}}"
set -ga status-right '#{E:@catppuccin_status_session}'


