set-option -ga terminal-overrides ",st-256color:Tc"

setw -g mode-keys vi
set -g mouse on

set-option escape-time 0

set-option -g allow-rename off

bind r source-file ~/.tmux.conf

bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
bind-key -T copy-mode-vi Escape send -X cancel

bind-key -n C-p run "xclip -o | tmux load-buffer -"
bind-key -n C-y run "tmux show-buffer | xclip -i -sel p -f | xclip -i -sel c"

bind-key -n C-e run "tmux setenv TMUX_PANE_CONTENT \"$(tmux capture-pane -p | sed 's/\\\"/\\\\\"/g')\" && tmux new-window -n:edit_pane \"echo $TMUX_PANE_CONTENT | nvim \\\"+normal G\\\" \\\"+set filetype=zsh\\\" -\" && tmux setenv -u TMUX_PANE_CONTENT"
