From de4419675004a02983f0416fa2726c993cfb66a5 Mon Sep 17 00:00:00 2001 From: Sarthak Jain Date: Sat, 18 Jul 2026 13:56:41 +0530 Subject: [PATCH] tmux configuration redesign --- tmux/.tmux.conf.local | 117 ++++++++++++----------------------- tmux/config/keybindings.conf | 67 ++++++++++++++++++++ tmux/config/settings.conf | 49 +++++++++++++++ 3 files changed, 154 insertions(+), 79 deletions(-) create mode 100644 tmux/config/keybindings.conf create mode 100644 tmux/config/settings.conf diff --git a/tmux/.tmux.conf.local b/tmux/.tmux.conf.local index 64b72ac..4d52a6a 100644 --- a/tmux/.tmux.conf.local +++ b/tmux/.tmux.conf.local @@ -71,42 +71,49 @@ tmux_conf_24b_colour=auto # - tmux_conf_theme_synchronized tmux_conf_theme=enabled -# Carbonfox Color Palette -color_bg="#161616" -color_fg="#f2f4f8" -color_black="#282828" -color_gray="#353535" -color_light_gray="#484848" -color_red="#ee5396" -color_green="#25be6a" -color_teal="#3ddbd9" -color_blue="#78a9ff" -color_purple="#be95ff" -color_cyan="#33b1ff" -color_white="#dfdfe0" +# Classic Monokai Color Palette +color_bg="#272822" +color_fg="#f8f8f2" +color_black="#1e1f1c" +color_gray="#3e3d32" +color_light_gray="#75715e" +color_red="#f92672" +color_green="#a6e22e" # Monokai Green (Session & Normal) +color_teal="#a6e22e" # Monokai Green +color_blue="#66d9ef" # Monokai Cyan/Blue +color_purple="#ae81ff" # Monokai Purple (Host & Visual) +color_cyan="#66d9ef" # Monokai Cyan (Active Window) +color_yellow="#e6db74" # Monokai Yellow (Date/Time) +color_white="#f8f8f2" -color_accent="$color_blue" +color_accent="$color_cyan" # Active window is Monokai Cyan color_primary="default" color_secondary="$color_gray" color_fg_primary="$color_fg" color_fg_secondary="$color_white" +# Curve variables bound to palette colors +color_blue_curve="$color_purple" +color_cyan_curve="$color_yellow" +color_purple_curve="$color_purple" + window_status_current_bg="default" window_status_current_fg="$color_accent" theme_mode_bg="$color_accent" theme_mode_fg="$color_bg" -tmux_conf_theme_window_fg="$color_fg_primary" +tmux_conf_theme_window_fg="#a5afc2" # window style tmux_conf_theme_window_bg="default" # highlight focused pane, possible values are: # - true # - false (default) -tmux_conf_theme_highlight_focused_pane=false +tmux_conf_theme_highlight_focused_pane=true # focused pane colours: +tmux_conf_theme_focused_pane_fg="#f2f4f8" tmux_conf_theme_focused_pane_bg="default" # pane border style, possible values are: @@ -174,7 +181,7 @@ tmux_conf_theme_window_status_attr="none" # tmux_conf_theme_window_status_format="#I #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,!,}#{?window_zoomed_flag,Z,}" #tmux_conf_theme_window_status_format="#{circled_window_index} #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,!,}#{?window_zoomed_flag,Z,}" # tmux_conf_theme_window_status_format=" #I: #(despell -e #W) #W #{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,🔔,}#{?window_zoomed_flag,🔍,}" -tmux_conf_theme_window_status_format="#[fg=$color_gray,bg=default]#[fg=$color_fg,bg=$color_gray]#I: #(bash /Users/jsarthak/dotfiles/tmux/tmux-window-name.sh '#W' '#{pane_current_path}')#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,🔔,}#{?window_zoomed_flag,🔍,}#[fg=$color_gray,bg=default]" +tmux_conf_theme_window_status_format="#[fg=$color_light_gray,bg=default]#I: #(bash /Users/jsarthak/dotfiles/tmux/tmux-window-name.sh '#W' '#{pane_current_path}')#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,🔔,}#{?window_zoomed_flag,🔍,}" # window current status style # - built-in variables are: @@ -189,7 +196,7 @@ tmux_conf_theme_window_status_format="#[fg=$color_gray,bg=default]#[fg=$color # tmux_conf_theme_window_status_current_format="#I #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,!,}#{?window_zoomed_flag,Z,}" #tmux_conf_theme_window_status_current_format="#{circled_window_index} #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,!,}#{?window_zoomed_flag,Z,}" # tmux_conf_theme_window_status_current_format="#I: #(despell -e #W) #[fg=$tmux_conf_theme_window_status_current_fg]#W*#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,🔔,}#{?window_zoomed_flag,🔍,}" -tmux_conf_theme_window_status_current_format="#[fg=$color_accent,bg=default]#[fg=$color_bg,bg=$color_accent,bold]#I: #(bash /Users/jsarthak/dotfiles/tmux/tmux-window-name.sh '#W' '#{pane_current_path}')#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,🔔,}#{?window_zoomed_flag,🔍,}#[fg=$color_accent,bg=default]" +tmux_conf_theme_window_status_current_format="#[fg=$color_accent,bg=default,bold]#I: #(bash /Users/jsarthak/dotfiles/tmux/tmux-window-name.sh '#W' '#{pane_current_path}')#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,🔔,}#{?window_zoomed_flag,🔍,}" tmux_conf_theme_window_status_current_fg="$window_status_current_fg" tmux_conf_theme_window_status_current_bg="$window_status_current_bg" @@ -249,18 +256,19 @@ tmux_conf_theme_right_separator_sub="" # - #{username} # - #{username_ssh} -tmux_conf_theme_status_left=" ❐ #S #[fg=$color_accent,bg=default,none]" -tmux_conf_theme_status_right=" #{prefix}#{mouse}#{pairing}#{synchronized} |#[fg=default,bg=default] #[fg=$color_secondary,bg=default,none]#[fg=$color_fg,bg=$color_secondary,none]󰔚 #{?uptime_d,#{uptime_d}d,}#{?uptime_h,#{uptime_h}h,}#{?uptime_m,#{uptime_m}m,}#[fg=$color_secondary,bg=default,none] |#[fg=default,bg=default] #[fg=$color_purple,bg=default,none]#[fg=$color_bg,bg=$color_purple,bold]󰊪 #{username}#{root}@#{hostname}#[fg=$color_purple,bg=default,none] " +tmux_conf_theme_status_left=" #[fg=$color_teal,bg=default,bold]❐ #S #[fg=$color_gray,bg=default,none]│" # status left style -tmux_conf_theme_status_left_fg="$color_bg" -tmux_conf_theme_status_left_bg="$color_accent" -tmux_conf_theme_status_left_attr="bold" +tmux_conf_theme_status_left_fg="default" +tmux_conf_theme_status_left_bg="default" +tmux_conf_theme_status_left_attr="none" + +tmux_conf_theme_status_right=" #{prefix}#{mouse}#{pairing}#{synchronized}#{?pane_in_mode,#{?selection_active,#[fg=$color_blue,bg=default,bold] VISUAL,#[fg=$color_green,bg=default,bold] NORMAL},} | #[fg=$color_fg,bg=default,none]󰔚 #{?uptime_d,#{uptime_d}d,}#{?uptime_h,#{uptime_h}h,}#{?uptime_m,#{uptime_m}m,} #[fg=$color_gray]│ #[fg=$color_cyan,bg=default,bold]󱑒 %d %b %H:%M #[fg=$color_gray]│ #[fg=$color_purple,bg=default,bold]󰊪 #{username}#{root}@#{hostname}" # status right style -tmux_conf_theme_status_right_fg="$color_red,$color_fg,$color_bg" -tmux_conf_theme_status_right_bg="default,$color_secondary,$color_purple" -tmux_conf_theme_status_right_attr="bold,none,bold" +tmux_conf_theme_status_right_fg="$color_red,$color_fg" +tmux_conf_theme_status_right_bg="default,default" +tmux_conf_theme_status_right_attr="bold,none" # pairing indicator tmux_conf_theme_pairing="⚇" # U+2687 @@ -352,38 +360,11 @@ tmux_conf_urlscan_options="--compact --dedupe" # -- user customizations ------------------------------------------------------- -# this is the place to override or undo settings -set-option -g detach-on-destroy off +# Source modular configurations +source-file "/Users/jsarthak/dotfiles/tmux/config/settings.conf" +source-file "/Users/jsarthak/dotfiles/tmux/config/keybindings.conf" -# increase history size -set -g history-limit 99999999 -set status-bg default - -# start with mouse mode enabled -set -g mouse on - -# Allow tmux to understand and pass through color queries -set -as terminal-overrides ",xterm*:Tc" -set -as terminal-overrides ",xterm*:RGB" - -# force Vi mode -# really you should export VISUAL or EDITOR environment variable, see manual -set -g status-keys vi -set -g mode-keys vi - -# replace C-b by C-a instead of using both prefixes -set -gu prefix2 -unbind C-a -unbind C-b -set -g prefix C-a -bind C-a send-prefix - -unbind -T copy-mode-vi MouseDragEnd1Pane -# if you don't want Oh my tmux! to alter a binding, use #!important -# bind c new-window -c '#{pane_current_path}' #!important - -# move status line to top -set -g status-position bottom +setw -g window-status-separator " #[fg=#484848]• " #!important # -- tpm ----------------------------------------------------------------------- @@ -427,28 +408,6 @@ set -g @plugin 'tmux-plugins/tmux-resurrect' #set -g @continuum-restore 'on' set -g @plugin 'tmux-plugins/tmux-logging' -# switch windows alt+number -bind-key -n M-1 select-window -t 1 -bind-key -n M-2 select-window -t 2 -bind-key -n M-3 select-window -t 3 -bind-key -n M-4 select-window -t 4 -bind-key -n M-5 select-window -t 5 -bind-key -n M-6 select-window -t 6 -bind-key -n M-7 select-window -t 7 -bind-key -n M-8 select-window -t 8 -bind-key -n M-9 select-window -t 9 -# Toggle popup window with Ctrl+ -bind-key -n -N 'Toggle popup window' M-p if-shell -F '#{==:#{session_name},popup}' { - detach-client -} { - display-popup -d "#{pane_current_path}" -xC -yC -w 70% -h 65% -E 'tmux attach-session -t popup || tmux new-session -s popup' -} -bind-key -n M-f "tmux-sessionizer\n" - -# Set alignment -set -g status-justify left -# set -g status-style fg=default,bg=default -# set mode-style "fg=black,bg=default" # -- custom variables ---------------------------------------------------------- # to define a custom #{foo} variable, define a POSIX shell function between the diff --git a/tmux/config/keybindings.conf b/tmux/config/keybindings.conf new file mode 100644 index 0000000..80d8d3d --- /dev/null +++ b/tmux/config/keybindings.conf @@ -0,0 +1,67 @@ +# ============================================================================== +# TMUX KEYBINDINGS +# ============================================================================== + +# Prefix key override: change from C-b to C-a +set -gu prefix2 +unbind C-a +unbind C-b +set -g prefix C-a +bind C-a send-prefix + +# Fast window switching with Alt + Number +bind-key -n M-1 select-window -t 1 +bind-key -n M-2 select-window -t 2 +bind-key -n M-3 select-window -t 3 +bind-key -n M-4 select-window -t 4 +bind-key -n M-5 select-window -t 5 +bind-key -n M-6 select-window -t 6 +bind-key -n M-7 select-window -t 7 +bind-key -n M-8 select-window -t 8 +bind-key -n M-9 select-window -t 9 + +# Toggle centered popup scratch terminal with Alt + p +bind-key -n -N 'Toggle popup window' M-p if-shell -F '#{==:#{session_name},popup}' { + detach-client +} { + display-popup -d "#{pane_current_path}" -xC -yC -w 70% -h 65% -E 'tmux attach-session -t popup || tmux new-session -s popup' +} + +# Run tmux-sessionizer with Alt + f +bind-key -n M-f send-keys "tmux-sessionizer\n" + +# Sleek centered FZF popup search overlays (requires fzf) +# Alt-s: Fuzzy search and switch sessions in popup +bind-key -n M-s display-popup -w 65% -h 50% -E "tmux list-sessions | fzf --reverse --header='Jump to Session' | cut -d: -f1 | xargs tmux switch-client -t" + +# Alt-w: Fuzzy search and switch windows in popup +bind-key -n M-w display-popup -w 75% -h 60% -E "tmux list-windows -a -F '#{session_name}:#{window_index} - #{window_name}' | fzf --reverse --header='Jump to Window' | cut -d' ' -f1 | xargs tmux select-window -t" + +# ============================================================================== +# COPY MODE (VI MODE) & INSTANT STATUS REDRAW +# ============================================================================== + +# Force immediate status redraw when entering copy mode +bind-key [ copy-mode \; refresh-client -S + +# vi-copy navigation and selection bindings with instant status bar update +bind-key -T copy-mode-vi v send-keys -X begin-selection \; refresh-client -S +bind-key -T copy-mode-vi V send-keys -X select-line \; refresh-client -S +bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle \; refresh-client -S +bind-key -T copy-mode-vi q send-keys -X cancel \; refresh-client -S +bind-key -T copy-mode-vi Escape send-keys -X cancel \; refresh-client -S +bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel \; refresh-client -S + +# Mouse Drag Selection: copy to clipboard and redraw instantly without leaving copy-mode +unbind -T copy-mode-vi MouseDragEnd1Pane +bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-selection-and-cancel \; refresh-client -S + +# ============================================================================== +# PANE NAVIGATION & RESIZING OVERRIDES (NO PREFIX) +# ============================================================================== + +# Resize panes using Shift + Arrow keys +bind -n S-Left resize-pane -L 2 +bind -n S-Right resize-pane -R 2 +bind -n S-Up resize-pane -U 2 +bind -n S-Down resize-pane -D 2 diff --git a/tmux/config/settings.conf b/tmux/config/settings.conf new file mode 100644 index 0000000..a0554b1 --- /dev/null +++ b/tmux/config/settings.conf @@ -0,0 +1,49 @@ +# ============================================================================== +# TMUX GENERAL SETTINGS +# ============================================================================== + +# Detach behavior: keep tmux alive when closing the last window/pane in a session +set-option -g detach-on-destroy off + +# Increase scrollback history limit +set -g history-limit 99999999 + +# Enable mouse mode (scrolling, selecting, pane resizing) +set -g mouse on + +# Terminal colors and overrides: pass through truecolor support +set -as terminal-overrides ",xterm*:Tc" +set -as terminal-overrides ",xterm*:RGB" +set -as terminal-overrides ",alacritty:Tc" +set -as terminal-overrides ",kitty:Tc" +set -as terminal-overrides ",wezterm:Tc" + +# Force VI mode for command status line and pane navigation/copy mode +set -g status-keys vi +set -g mode-keys vi + +# Keep the status line positioned at the bottom +set -g status-position bottom + +# Left-justify the window list and set a subtle dot separator between windows +set -g status-justify left +setw -g window-status-separator " #[fg=#484848]• " + +# ============================================================================== +# PANE STYLING & BORDER STATUS LINE +# ============================================================================== + +# Custom pane border colors +set -g pane-border-style "fg=#353535,bg=default" +set -g pane-active-border-style "fg=#78a9ff,bg=default" + +# Disable status line on the pane borders +set -g pane-border-status off + +# ============================================================================== +# POPUP WINDOW STYLING +# ============================================================================== + +# Make popups transparent +set -g popup-style "bg=default" +set -g popup-border-style "fg=#353535,bg=default"