Files
2026-03-21 20:19:08 +03:00

87 lines
2.8 KiB
Bash

set-option -sa terminal-overrides ",xterm*:Tc"
set -g mouse on
set -g base-index 1
set -g renumber-windows on
set -g status-position bottom
set -g status-style 'bg=#333333 fg=#5eacd3'
set -g pane-border-style "fg=#333333"
set -g pane-active-border-style "bg=default fg=#333333"
set-option -sa terminal-features ',alacritty:RGB'
set-option -g history-limit 20000
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-plugins'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g status-left "#{?@session-type,#[fg=#5eacd3]SSH: #{@ssh-host} ,}#[fg=#5eacd3]#S "
bind r source-file ~/.config/tmux/tmux.conf
# Pane navigation (preserved)
bind -r ^ last-window
bind -r k select-pane -U
bind -r j select-pane -D
bind -r h select-pane -L
bind -r l select-pane -R
bind q kill-window
bind o kill-pane -a
# Prefix configuration
set -g prefix C-a
bind C-a send-prefix
# Enhanced scroll handling with remote session awareness
tmux_commands_with_legacy_scroll="nano less more man git ansible-doc"
bind-key -T root WheelUpPane \
if-shell -Ft= '#{?mouse_any_flag,1,#{pane_in_mode}}' \
'send -Mt=' \
'if-shell -t= "#{?alternate_on,true,false} || echo \"#{tmux_commands_with_legacy_scroll}\" | grep -q \"#{pane_current_command}\"" \
"send -t= Up" "copy-mode -et="'
bind-key -T root WheelDownPane \
if-shell -Ft = '#{?pane_in_mode,1,#{mouse_any_flag}}' \
'send -Mt=' \
'if-shell -t= "#{?alternate_on,true,false} || echo \"#{tmux_commands_with_legacy_scroll}\" | grep -q \"#{pane_current_command}\"" \
"send -t= Down" "send -Mt="'
bind-key X run-shell " \
current=$(tmux display-message -p '#{session_name}'); \
if tmux show-option -t \"$current\" -qv @session-type | grep -q ssh; then \
tmux switch-client -l; \
tmux kill-session -t \"$current\"; \
else \
tmux display-message 'Not a remote session'; \
fi"
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
bind e run-shell "tmux show-option -v @session-type >/dev/null && \
tmux split-window -v 'ssh -t #{@ssh-host}' || \
tmux split-window -v -c '#{pane_current_path}'"
bind s run-shell "tmux show-option -v @session-type >/dev/null && \
tmux split-window -h 'ssh -t #{@ssh-host}' || \
tmux split-window -h -c '#{pane_current_path}'"
bind-key C-f run-shell '~/.local/scripts/tmux-sessionizer'
bind-key S display-popup -E -w 80% -h 60% '~/.local/scripts/tmux-ssh-fzf'
set-option -g default-command ' \
if [ -n "$(tmux show -qv @session-type)" ]; then \
ssh -t "$(tmux show -qv @ssh-host)"; \
else \
exec $SHELL; \
fi'
run '~/.config/tmux/plugins/tpm/tpm'