configs/desktop/configs/tmux/.config/tmux/tmux.conf
2024-07-19 00:08:03 -03:00

80 lines
2.5 KiB
Plaintext

set -g prefix C-a
unbind C-b
bind-key C-a send-prefix
set -g default-terminal "tmux-256color"
set-option -sa terminal-overrides ",xterm-kitty:RGB"
set-option -ga terminal-overrides ",xterm-256color:Tc"
unbind C-o
bind C-o display-popup -E "~/.cargo/bin/tms"
unbind C-j
bind C-j display-popup -E "~/.cargo/bin/tms switch"
unbind %
bind | split-window -h
unbind '"'
bind _ split-window -v
unbind r
bind r source-file ~/.config/tmux/tmux.conf
bind C-z set-option -g status
bind -r j resize-pane -D 5
bind -r k resize-pane -U 5
bind -r l resize-pane -R 5
bind -r h resize-pane -L 5
bind -r m resize-pane -Z
set -g mouse on
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection
set -ga update-environment 'KITTY_LISTEN_ON'
set -gq allow-passthrough on
unbind -T copy-mode-vi MouseDragEnd1Pane
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
bind-key -n 'C-Space' if-shell "$is_vim" 'send-keys C-Space' 'select-pane -t:.+'
bind-key -T copy-mode-vi 'C-h' select-pane -L
bind-key -T copy-mode-vi 'C-j' select-pane -D
bind-key -T copy-mode-vi 'C-k' select-pane -U
bind-key -T copy-mode-vi 'C-l' select-pane -R
bind-key -T copy-mode-vi 'C-\' select-pane -l
bind-key -T copy-mode-vi 'C-Space' select-pane -t:.+
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'richin13/tmux-plugin-playerctl'
set-option -g set-titles on
set-option -g set-titles-string "#S / #W"
source ~/.config/tmux/theme.conf
set -g visual-bell off
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours - needs tmux-3.0
set -g status-position top
run '~/.config/tmux/plugins/tpm/tpm'