set -g mouse on
set -sg escape-time 0
unbind-key -a

set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'

set -g default-terminal "tmux-256color"
set -ag terminal-overrides ",xterm-256color:RGB"


bind-key    -T root C-b       send-prefix
bind-key    -T prefix C-b     send-prefix

bind-key    -T prefix t       new-window
bind-key    -T prefix n       next-window
bind-key    -T prefix p       previous-window

bind-key    -T prefix \"      split-window
bind-key    -T prefix \%      split-window -h


bind-key -r -T prefix Up      select-pane -U
bind-key -r -T prefix Down    select-pane -D
bind-key -r -T prefix Left    select-pane -L
bind-key -r -T prefix Right   select-pane -R


bind-key    -T prefix C-o     rotate-window
bind-key    -T prefix C-z     suspend-client
bind-key    -T prefix Space   next-layout
bind-key    -T prefix \#      list-buffers


bind-key    -T prefix &       confirm-before -p "kill-window #W? (y/n)" kill-window
bind-key    -T prefix ,       command-prompt -I "#W" { rename-window "%%" }
bind-key    -T prefix .       command-prompt -T target { move-window -t "%%" }
bind-key    -T prefix :       command-prompt
bind-key    -T prefix <       display-menu -T "#[align=centre]#{window_index}:#{window_name}" -x W -y W "#{?#{>:#{session_windows},1},,-}Swap Left" l { swap-window -t :-1 } "#{?#{>:#{session_windows},1},,-}Swap Right" r { swap-window -t :+1 } "#{?pane_marked_set,,-}Swap Marked" s { swap-window } '' Kill X { kill-window } Respawn R { respawn-window -k } "#{?pane_marked,Unmark,Mark}" m { select-pane -m } Rename n { command-prompt -F -I "#W" { rename-window -t "#{window_id}" "%%" } } '' "New After" w { new-window -a } "New At End" W { new-window }
bind-key    -T prefix =       choose-buffer -Z
bind-key    -T prefix >       display-menu -T "#[align=centre]#{pane_index} (#{pane_id})" -x P -y P "#{?#{m/r:(copy|view)-mode,#{pane_mode}},Go To Top,}" < { send-keys -X history-top } "#{?#{m/r:(copy|view)-mode,#{pane_mode}},Go To Bottom,}" > { send-keys -X history-bottom } '' "#{?mouse_word,Search For #[underscore]#{=/9/...:mouse_word},}" C-r { if-shell -F "#{?#{m/r:(copy|view)-mode,#{pane_mode}},0,1}" "copy-mode -t=" ; send-keys -X -t = search-backward "#{q:mouse_word}" } "#{?mouse_word,Type #[underscore]#{=/9/...:mouse_word},}" C-y { copy-mode -q ; send-keys -l "#{q:mouse_word}" } "#{?mouse_word,Copy #[underscore]#{=/9/...:mouse_word},}" c { copy-mode -q ; set-buffer "#{q:mouse_word}" } "#{?mouse_line,Copy Line,}" l { copy-mode -q ; set-buffer "#{q:mouse_line}" } '' "#{?mouse_hyperlink,Type #[underscore]#{=/9/...:mouse_hyperlink},}" C-h { copy-mode -q ; send-keys -l "#{q:mouse_hyperlink}" } "#{?mouse_hyperlink,Copy #[underscore]#{=/9/...:mouse_hyperlink},}" h { copy-mode -q ; set-buffer "#{q:mouse_hyperlink}" } '' "Horizontal Split" h { split-window -h } "Vertical Split" v { split-window -v } '' "#{?#{>:#{window_panes},1},,-}Swap Up" u { swap-pane -U } "#{?#{>:#{window_panes},1},,-}Swap Down" d { swap-pane -D } "#{?pane_marked_set,,-}Swap Marked" s { swap-pane } '' Kill X { kill-pane } Respawn R { respawn-pane -k } "#{?pane_marked,Unmark,Mark}" m { select-pane -m } "#{?#{>:#{window_panes},1},,-}#{?window_zoomed_flag,Unzoom,Zoom}" z { resize-pane -Z }
bind-key    -T prefix ?       list-keys -N
bind-key    -T prefix C       customize-mode -Z
bind-key    -T prefix M       select-pane -M
bind-key    -T prefix [       copy-mode
bind-key    -T prefix ]       paste-buffer -p
bind-key    -T prefix f       command-prompt { find-window -Z "%%" }
bind-key    -T prefix i       display-message
bind-key    -T prefix r       refresh-client
bind-key    -T prefix x       confirm-before -p "kill-pane #P? (y/n)" kill-pane
bind-key    -T prefix z       resize-pane -Z
bind-key    -T prefix \~      show-messages
bind-key -r -T prefix DC      refresh-client -c
bind-key    -T prefix PPage   copy-mode -u

bind-key    -T prefix M-n     next-window -a
bind-key    -T prefix M-o     rotate-window -D
bind-key    -T prefix M-p     previous-window -a
bind-key -r -T prefix M-Up    resize-pane -U 5
bind-key -r -T prefix M-Down  resize-pane -D 5
bind-key -r -T prefix M-Left  resize-pane -L 5
bind-key -r -T prefix M-Right resize-pane -R 5
bind-key -r -T prefix C-Up    resize-pane -U
bind-key -r -T prefix C-Down  resize-pane -D
bind-key -r -T prefix C-Left  resize-pane -L
bind-key -r -T prefix C-Right resize-pane -R
bind-key -r -T prefix S-Up    refresh-client -U 10
bind-key -r -T prefix S-Down  refresh-client -D 10
bind-key -r -T prefix S-Left  refresh-client -L 10
bind-key -r -T prefix S-Right refresh-client -R 10

run '~/.tmux/plugins/tpm/tpm'

