# set -g default-terminal "screen-256color" set-option -sa terminal-overrides ",xterm*:Tc" # easy reload config bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded." set-option -g status-position top # set window split bind v split-window -h -c "#{pane_current_path}" bind b split-window -v -c "#{pane_current_path}" # C-b is not acceptable -- Vim uses it set-option -g prefix C-a bind-key C-a last-window # Start numbering at 1 set -g base-index 1 # Allows for faster key repetition set -s escape-time 50 # Rather than constraining window size to the maximum size of any client # connected to the *session*, constrain window size to the maximum size of any # client connected to *that window*. Much more reasonable. setw -g aggressive-resize on is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?\.?(view|n?vim?x?)(-wrapped)?(diff)?$'" bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' { if -F '#{pane_at_left}' '' 'select-pane -L' } bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' { if -F '#{pane_at_bottom}' '' 'select-pane -D' } bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' { if -F '#{pane_at_top}' '' 'select-pane -U' } bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' { if -F '#{pane_at_right}' '' 'select-pane -R' } bind-key -T copy-mode-vi 'C-h' if -F '#{pane_at_left}' '' 'select-pane -L' bind-key -T copy-mode-vi 'C-j' if -F '#{pane_at_bottom}' '' 'select-pane -D' bind-key -T copy-mode-vi 'C-k' if -F '#{pane_at_top}' '' 'select-pane -U' bind-key -T copy-mode-vi 'C-l' if -F '#{pane_at_right}' '' 'select-pane -R' bind-key C command-prompt -p "Name of new window: " "new-window -n '%%'" 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 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 bind 'V' copy-mode # Enable mouse control (clickable windows, panes, resizable panes) set -g mouse on unbind -T copy-mode-vi MouseDragEnd1Pane bind S command-prompt -p "New Session:" "new-session -A -s '%%'" bind K confirm kill-session bind-key -r f run-shell "tmux neww ~/.local/bin/tmux-sessionizer" # List of plugins set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-sensible' set -g @plugin 'catppuccin/tmux' set -g @catppuccin_flavour 'mocha' set -g @catppuccin_status_left_separator "" set -g @catppuccin_window_middle_separator " " set -g @catppuccin_status_modules_right "application session directory date_time" # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) run '~/.tmux/plugins/tpm/tpm'