From 14d6e938b81c6ecdcabbcb0d94fc2dbb24742373 Mon Sep 17 00:00:00 2001 From: afranco Date: Sun, 16 Mar 2025 01:13:24 +0000 Subject: [PATCH] chore(tmux): make the config a single file for simplicity --- .config/tmux/tmux.conf | 90 ++++++++++++++++++++++++++++--- .config/tmux/tmux_binds.conf | 34 ------------ .config/tmux/tmux_copy_mode.conf | 10 ---- .config/tmux/tmux_general.conf | 19 ------- .config/tmux/tmux_init.conf | 6 --- .config/tmux/tmux_plugins.conf | 15 ------ .config/tmux/tmux_status_bar.conf | 35 ------------ 7 files changed, 84 insertions(+), 125 deletions(-) delete mode 100644 .config/tmux/tmux_binds.conf delete mode 100644 .config/tmux/tmux_copy_mode.conf delete mode 100644 .config/tmux/tmux_general.conf delete mode 100644 .config/tmux/tmux_init.conf delete mode 100644 .config/tmux/tmux_plugins.conf delete mode 100644 .config/tmux/tmux_status_bar.conf diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index ab7ea46..8792039 100644 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -1,9 +1,87 @@ # tmux.conf -source-file ~/.config/tmux/tmux_general.conf -source-file ~/.config/tmux/tmux_binds.conf -source-file ~/.config/tmux/tmux_copy_mode.conf -source-file ~/.config/tmux/tmux_plugins.conf -source-file ~/.config/tmux/tmux_init.conf -source-file ~/.config/tmux/tmux_status_bar.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' diff --git a/.config/tmux/tmux_binds.conf b/.config/tmux/tmux_binds.conf deleted file mode 100644 index ef3c724..0000000 --- a/.config/tmux/tmux_binds.conf +++ /dev/null @@ -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" diff --git a/.config/tmux/tmux_copy_mode.conf b/.config/tmux/tmux_copy_mode.conf deleted file mode 100644 index 33656a5..0000000 --- a/.config/tmux/tmux_copy_mode.conf +++ /dev/null @@ -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 diff --git a/.config/tmux/tmux_general.conf b/.config/tmux/tmux_general.conf deleted file mode 100644 index d40021f..0000000 --- a/.config/tmux/tmux_general.conf +++ /dev/null @@ -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 diff --git a/.config/tmux/tmux_init.conf b/.config/tmux/tmux_init.conf deleted file mode 100644 index 11faff1..0000000 --- a/.config/tmux/tmux_init.conf +++ /dev/null @@ -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' - diff --git a/.config/tmux/tmux_plugins.conf b/.config/tmux/tmux_plugins.conf deleted file mode 100644 index b46202c..0000000 --- a/.config/tmux/tmux_plugins.conf +++ /dev/null @@ -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' - diff --git a/.config/tmux/tmux_status_bar.conf b/.config/tmux/tmux_status_bar.conf deleted file mode 100644 index a00bea7..0000000 --- a/.config/tmux/tmux_status_bar.conf +++ /dev/null @@ -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}}"