nix/config/tmux/tmux.conf

86 lines
3 KiB
Bash

set -s escape-time 0
set -g history-limit 50000
set -g base-index 1
set -g pane-base-index 1
set -g mouse on
setw -g aggressive-resize on
set -g focus-events on
setw -g mode-keys vi
set -g prefix M-x
unbind C-b
bind M-x send
set -g default-terminal "$TERM"
set -g default-shell "$SHELL"
set -g renumber-windows on
setw -g automatic-rename off
set -g status-position bottom
set -g status-interval 5
set -g @c ','
set-hook -g session-created 'run "mux bar"'
set-hook -g session-closed 'run "mux bar"'
set-hook -g client-session-changed 'run "mux bar"'
set-hook -g pane-mode-changed 'refresh-client -S'
set -as terminal-features ",$TERM:RGB"
set -as terminal-overrides ",*:U8=1"
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'
unbind Left; bind h selectp -L
unbind Down; bind j selectp -D
unbind Up; bind k selectp -U
unbind Right; bind l selectp -R
unbind :; bind : display-popup -E 'mux cmd'\; refresh -S
unbind S; bind S display-popup -E 'mux pick-session'\; refresh -S
unbind W; bind W display-popup -E 'mux pick-window'\; refresh -S
unbind P; bind P display-popup -E 'mux pick-pane'\; refresh -S
bind -r Left resizep -L 5
bind -r Right resizep -R 5
bind -r Up resizep -U 5
bind -r Down resizep -D 5
unbind \'; bind \' splitw -hc '#{pane_current_path}'
unbind \-; bind \- splitw -vc '#{pane_current_path}'
unbind y; bind y if -F '#{pane_in_mode}' 'send-keys -X cancel' 'copy-mode'
unbind /; bind / if -F '#{pane_in_mode}' { send-keys -X cancel } { copy-mode ; command-prompt -p '/' { send -X search-forward -- '%%' } }
unbind ?; bind ? if -F '#{pane_in_mode}' { send-keys -X cancel } { copy-mode ; command-prompt -p '?' { send -X search-backward -- '%%' } }
bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'test -n "$WAYLAND_DISPLAY" && wl-copy || xclip -in -sel c'
unbind b; bind b set status\; refresh -S
unbind m; bind m set -g mouse\; run-shell 'mux bar'\; refresh -S
unbind ^; bind ^ last-window
unbind w; bind w kill-pane;
unbind e; bind e neww -n 'tmux.conf' "sh -c 'nvim $XDG_CONFIG_HOME/nix/config/tmux/tmux.conf; tmux source $XDG_CONFIG_HOME/tmux/tmux.conf'"
unbind H; bind H run 'mux switch 0'\; refresh -S
unbind J; bind J run 'mux switch 1'\; refresh -S
unbind K; bind K run 'mux switch 2'\; refresh -S
unbind L; bind L run 'mux switch 3'\; refresh -S
unbind \$; bind \$ run 'mux switch 4'\; refresh -S
unbind Tab; bind Tab switchc -l
set-hook -g client-light-theme 'source $XDG_CONFIG_HOME/tmux/themes/daylight.conf'
set-hook -g client-dark-theme 'source $XDG_CONFIG_HOME/tmux/themes/midnight.conf'
run 'tmux source "$XDG_CONFIG_HOME/tmux/themes/${THEME:-midnight}.conf"'
unbind a; bind a run 'mux ai'
unbind c; bind c run 'mux code'
unbind r; bind r run 'mux run'
unbind s; bind s run 'mux shell'
unbind g; bind g run 'mux git'
unbind m; bind m run 'mux misc'
set -g lock-after-time 300
set -g lock-command "pipes -p 2"