From 0a89d0c4fb0357fd02089d5bfa7f002dc9548dc4 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Tue, 7 Oct 2025 13:07:15 +0545 Subject: [PATCH] feat(tmux): configure tmux with custom theme and keybindings for improved usability --- config/tmux/theme.conf | 39 ++++++++++++++++----------------------- config/tmux/tmux.conf | 26 ++++++++++++++++++++++---- 2 files changed, 38 insertions(+), 27 deletions(-) diff --git a/config/tmux/theme.conf b/config/tmux/theme.conf index e818b9d2..7a800ccc 100644 --- a/config/tmux/theme.conf +++ b/config/tmux/theme.conf @@ -1,34 +1,27 @@ - set -g status-interval 1 set -g status-left-length 100 +set -g status-right-length 100 -set -g status-left "#{?pane_in_mode,#[bold fg=black]#[bg=yellow]  COPY #[fg=yellow bg=white],#{?window_zoomed_flag,#[bold fg=black]#[bg=cyan]  ZOOM #[fg=cyan bg=white],#{?client_prefix,#[bold fg=black]#[bg=red]  CMND #[fg=red bg=white],#[bold fg=black]#[bg=brightwhite]  TMUX #[fg=brightwhite bg=white]}}}" -set -ag status-left "#[fg=white bg=brightblack]" +# Remove the default +set -g status-right "" +set -g status-left "" -# Add the session name -set -ag status-left "#[fg=brightwhite bg=brightblack]  #(basename $SHELL) " -set -ag status-left "#[fg=brightblack bg=black]" +# Add your custom right section +set -g status-right "#[fg=white]#S #[default]· #{?pane_in_mode,#[bold fg=yellow]  ,#{?window_zoomed_flag,#[bold fg=cyan]  ,#{?client_prefix,#[bold fg=red]  ,#[bold fg=blue]  }}} #[fg=brightblack]" -set -ag status-left "#[fg=white]  #S · #{}" - -set -g status-right "#[fg=brightwhite] #{pane_current_command} " - -# CPU -set -ag status-right "#[fg=red]#[fg=black bg=red] #[fg=brightwhite bg=brightblack] #{cpu_percentage} " -# RAM -set -ag status-right "#[fg=green]#[fg=black bg=green]󰍛 #[fg=brightwhite bg=brightblack] #{ram} " -# TIME -set -ag status-right "#[fg=blue]#[fg=black bg=blue]󰥔 #[fg=blue bg=brightblack] %H:%M #{}" - -set -g status-bg black -set -g status-fg white +set -g status-style bg=default set -g pane-active-border-style "fg=blue" set -g pane-border-style "fg=black" -# Inactive windows -set -g window-status-format "#[fg=grey] #[default]#{b:pane_current_path}" +# Inactive Window +set -g window-status-format "#[fg=white]#(name=\"#I\"; short=\$(echo \"\$name\" | cut -c1-16); echo -n \" \$short \")" + +# Active Window +set -g window-status-current-format "#[fg=red,bold]#(name=\"#I\"; short=\$(echo \"\$name\" | cut -c1-16); echo -n \" \$short \")" + +# Align windows +set -g status-justify "left" # left | centre | right + -# Active window -set -g window-status-current-format "#[fg=brightwhite] #[bold]#{b:pane_current_path}" diff --git a/config/tmux/tmux.conf b/config/tmux/tmux.conf index 9d5ec12b..0b731857 100644 --- a/config/tmux/tmux.conf +++ b/config/tmux/tmux.conf @@ -6,8 +6,12 @@ # │ │ # └──────────────────────────┘ +# easy reload config +bind-key r source-file ~/.config/tmux/tmux.conf \; display-message "Config reloaded..." +bind-key G popup -w90% -h90% -E "lazygit" +# bind-key z popup -w90% -h90% -E "yazi" # Set default shell -set-option -g default-shell $SHELL +set -g default-command "${SHELL}" # Set true color set-option -sa terminal-overrides ",xterm*:Tc" @@ -24,18 +28,26 @@ bind C-Space send-prefix bind -n M-H previous-window bind -n M-L next-window +# bind-key C command-prompt -p "Name of new window: " "new-window -n '%%'" + +# # New session +# bind-key L command-prompt -p "Enter session name:" "new-session -s '%%'" +# +# # Rename current session +# bind R command-prompt -p "Enter session name:" "rename-session '%%'" + # Start window numbering at 1 set -g base-index 1 setw -g pane-base-index 1 set-window-option -g pane-base-index 1 set-option -g renumber-windows on + set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-sensible' set -g @plugin 'christoomey/vim-tmux-navigator' set -g @plugin 'tmux-plugins/tmux-yank' -set -g @plugin 'tmux-plugins/tmux-cpu' -set -g @plugin 'pwittchen/tmux-plugin-ram' + source-file ~/.config/tmux/theme.conf # Set vi-mode @@ -43,10 +55,10 @@ set-window-option -g mode-keys vi # Yazi set -g allow-passthrough on - set -ga update-environment TERM set -ga update-environment TERM_PROGRAM + # Keybindings bind-key -T copy-mode-vi v send-keys -X begin-selection bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle @@ -56,4 +68,10 @@ bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel bind - split-window -c '#{pane_current_path}' bind / split-window -h -c '#{pane_current_path}' +# Toggle Status Bar +bind-key b set-option status + +if "test ! -d ~/.tmux/plugins/tpm" \ + "run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'" + run '~/.tmux/plugins/tpm/tpm'