dotfiles/.config/tmux/tmux.conf

87 lines
2.5 KiB
Bash

# tmux.conf
# General
set -g default-terminal "tmux-256color"
set -gq allow-passthrough on
set -g visual-activity off
set -sa terminal-features ",*:RGB"
set -sg escape-time 0
set -g mouse on
set -g base-index 1
set -g pane-base-index 1
set -g detach-on-destroy off
set -g history-limit 250000
set -g set-clipboard on
set -g renumber-windows on
setw -g mode-keys vi
# Status
set -g status-right ""
set -g status-left-length 20
set -g status-position top
set -g status-justify left
set -g status-style 'bg=#181926 fg=#cad3f5'
set -g status-left '[#S] '
set -g status-style ' #[bg=#{status-bg},fg=#{@unfocused-fg}]'
set -g window-status-format ' #I:#W '
set -g window-status-current-format '#[bg=#{@focused-bg},fg=#{@focused-fg}] #I:#W '
# Theme
set -g status-bg "#1d2021"
set -g @unfocused-fg "#ebdbb2"
set -g @focused-bg "#ebdbb2"
set -g @focused-fg "#1d2021"
# Plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'niqodea/tmux-matryoshka'
set -g @plugin 'laktak/extrakto'
# Plugin settings
set -g @resurrect-strategy-nvim 'session'
set -g @resurrect-capture-pane-contents 'on'
set -g @continuum-save-interval '5'
set -g @open-lazygit 'g'
# Binds
bind-key 'x' kill-pane
bind-key 'h' previous-window
bind-key 'j' switch-client -p
bind-key 'k' switch-client -n
bind-key 'l' next-window
bind-key 'n' new-window -c '#{pane_current_path}'
bind-key 'N' new-window
bind-key 'c' kill-window
# Decide whether we're in a Vim process
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
unbind y
bind-key 'y' if-shell "$is_vim" 'send-keys F5' 'select-pane -L'
unbind u
bind-key 'u' if-shell "$is_vim" 'send-keys F6' 'select-pane -D'
unbind i
bind-key 'i' if-shell "$is_vim" 'send-keys F7' 'select-pane -U'
unbind o
bind-key 'o' if-shell "$is_vim" 'send-keys F8' 'select-pane -R'
unbind s
bind-key 's' display-popup -E -w 60% -h 40% "~/.local/bin/tms"
unbind t
bind-key 't' display-popup -E -w 60% -h 40% "~/.local/bin/change-theme.sh"
unbind g
bind-key 'g' display-popup -d '#{pane_current_path}' -E -w 100% -h 100% "lazygit"
# Copy mode
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy"
bind P paste-buffer
# Copy mode mouse
unbind-key -T copy-mode-vi MouseDragEnd1Pane
bind-key -T copy-mode-vi MouseDown1Pane select-pane\; send-keys -X clear-selection
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
set-environment -g PATH "/opt/homebrew/bin:/bin:/usr/bin"
run '~/.config/tmux/plugins/tpm/tpm'