From e25ccd34c7321c6b5a5e7a1e0099ceecc0ee129e Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Tue, 7 Oct 2025 16:37:23 +0545 Subject: [PATCH] feat(tmux): configure tmux with plugins, keybinds and theme --- config/tmux/binds.conf | 56 ++++++++++++++++++++++++++++++++++++++++++ config/tmux/theme.conf | 25 ++++++++++--------- config/tmux/tmux.conf | 44 ++------------------------------- 3 files changed, 72 insertions(+), 53 deletions(-) create mode 100644 config/tmux/binds.conf diff --git a/config/tmux/binds.conf b/config/tmux/binds.conf new file mode 100644 index 00000000..1f3e7ece --- /dev/null +++ b/config/tmux/binds.conf @@ -0,0 +1,56 @@ +# Set prefix +unbind C-b +set -g prefix C-Space +bind C-Space send-prefix + +# Set vi-mode +set-window-option -g mode-keys vi + +# easy reload config +bind-key r source-file ~/.config/tmux/tmux.conf \; display-message "Config reloaded..." + +# Shift Alt vim keys to switch windows +bind -n M-H previous-window +bind -n M-L next-window + +# Choose Window +bind-key '"' choose-window + +# Resize Pane +bind-key + resize-pane -Z + +# Detach Session +bind-key d detach + +# cycle thru MRU tabs +bind-key -r Tab last-window + +# New session +bind-key N command-prompt -p "Enter session name:" "new-session -s '%%'" + +# Rename current session +bind R command-prompt -p "Enter session name:" "rename-session '%%'" + +# Rename Window +bind-key W command-prompt -I "Enter window name:" "rename-window '%%'" + +# Open panes in current directory +bind - split-window -c '#{pane_current_path}' +bind / split-window -h -c '#{pane_current_path}' + +#Lagygit +bind-key G popup -w90% -h90% -E "lazygit" +bind-key z popup -w50% -h50% -E "yazi" +bind-key -n C-b popup -w55% -h50% -E "btop" + +# Copy Mode +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 +bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel + +# Resize Pane +bind-key -r h resize-pane -L +bind-key -r l resize-pane -R +bind-key -r j resize-pane -D +bind-key -r k resize-pane -U + diff --git a/config/tmux/theme.conf b/config/tmux/theme.conf index 7a800ccc..ebd58830 100644 --- a/config/tmux/theme.conf +++ b/config/tmux/theme.conf @@ -1,27 +1,30 @@ set -g status-interval 1 -set -g status-left-length 100 set -g status-right-length 100 - # Remove the default set -g status-right "" set -g status-left "" +setw -g pane-border-format "" -# 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]" - +# General +setw -g pane-border-status bottom +setw -g pane-border-lines single set -g status-style bg=default -set -g pane-active-border-style "fg=blue" -set -g pane-border-style "fg=black" -# Inactive Window +# 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]" + +# Pane +set -g pane-border-style "fg=brightblack" +set -g pane-active-border-style "fg=brightblack" +set -g pane-border-format "#[align=centre] #{pane_index} • #W " + +# Active/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 +set -g status-justify "left" diff --git a/config/tmux/tmux.conf b/config/tmux/tmux.conf index 0b731857..8f767f1f 100644 --- a/config/tmux/tmux.conf +++ b/config/tmux/tmux.conf @@ -6,71 +6,31 @@ # │ │ # └──────────────────────────┘ -# 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 -g default-command "${SHELL}" -# Set true color set-option -sa terminal-overrides ",xterm*:Tc" - -# Set mouse mode on set -g mouse on -# Set prefix -unbind C-b -set -g prefix C-Space -bind C-Space send-prefix - -# Shift Alt vim keys to switch windows -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 - +# Plugins 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' source-file ~/.config/tmux/theme.conf +source-file ~/.config/tmux/binds.conf -# Set vi-mode -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 -bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel - -# Open panes in current directory -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'"