chore(tmux): make the config a single file for simplicity

This commit is contained in:
Afonso Franco 2025-03-16 01:13:24 +00:00
parent 8aeb7e3c87
commit 14d6e938b8
Signed by: afonso
SSH key fingerprint: SHA256:gkVPzsQQJzqi21ntQBV6pXTx4bYI53rFGI4XtvCpwd4
7 changed files with 84 additions and 125 deletions

View file

@ -1,9 +1,87 @@
# tmux.conf # tmux.conf
source-file ~/.config/tmux/tmux_general.conf # General
source-file ~/.config/tmux/tmux_binds.conf set -g default-terminal "tmux-256color"
source-file ~/.config/tmux/tmux_copy_mode.conf set -gq allow-passthrough on
source-file ~/.config/tmux/tmux_plugins.conf set -g visual-activity off
source-file ~/.config/tmux/tmux_init.conf set -sa terminal-features ",*:RGB"
source-file ~/.config/tmux/tmux_status_bar.conf 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'

View file

@ -1,34 +0,0 @@
# tmux_binds.conf
# 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'
# Tmus sessionizer
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"

View file

@ -1,10 +0,0 @@
# tmux_copy_mode.conf
# 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

View file

@ -1,19 +0,0 @@
# tmux_general.conf
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 status-position top
set -g renumber-windows on
setw -g mode-keys vi
set -g status-style 'bg=#181926 fg=#cad3f5'
set -g status-right ""
set -g status-left-length 20

View file

@ -1,6 +0,0 @@
# tmux_init.conf
# 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'

View file

@ -1,15 +0,0 @@
# tmux_plugins.conf
# List of 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'
set -g @plugin 'Morantron/tmux-fingers'
# 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'

View file

@ -1,35 +0,0 @@
#!/usr/bin/env bash
# Hardcoded values
set -g status-bg "#272e33"
set -g @unfocused-fg "#3c4841"
set -g @focused-bg "#3c4841"
set -g @focused-fg "#d3c6aa"
# Set status bar position
set -g status-position top
# Set status bar justification
set -g status-justify left
# Set right side of the status bar
set -g status-right '#(cat #{socket_path}-\#{session_id}-vimbridge-R)'
set -g status-left '[#S] '
# Set status bar style
set -g status-style ' #[bg=#{status-bg},fg=#{@unfocused-fg}]'
# Set window status format
set -g window-status-format ' #I:#W '
# Set window status format for the current window
set -g window-status-current-format '#[bg=#{@focused-bg},fg=#{@focused-fg}] #I:#W '
# AUTO RENAME WINDOW
#set-option -g status-interval 5
#set-option -g automatic-rename on
#set-option -g automatic-rename-format "#{?#{==:#{pane_current_command},zsh},#{b:pane_current_path},#{pane_current_command}}"