Files
dotfiles/.config/tmux/tmux.conf

126 lines
4.5 KiB
Bash

### General Settings
# Enable mouse support in tmux
set -g mouse on
# Set the default terminal type to "tmux-256color" for better color support
set -g default-terminal "tmux-256color"
# Set the base index for windows to 1 (instead of the default 0)
set -g base-index 1
# Set the base index for panes to 1 (instead of the default 0)
setw -g pane-base-index 1
# Increase the history limit (useful for longer command histories)
set-option -g history-limit 10000
### Startup Configuration
# Start a new session named "main" if none exists
new-session -s main
# Start htop and split the window when the session "main" is created
set-hook -t main session-created 'send-keys -t main:1 "sudo htop" C-m; split-window'
### Key Bindings
# Remap the prefix key from 'C-b' (Ctrl-b) to 'C-a' (Ctrl-a)
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# Split panes using 'h' for horizontal and 'v' for vertical splits
bind "h" split-window -h
bind "v" split-window -v
unbind '"'
unbind %
# Reload the tmux configuration file with 'r'
bind r source-file $XDG_CONFIG_HOME/tmux/tmux.conf
### Clipboard Integration
# Enable clipboard
set -s set-clipboard on
set -ag terminal-overrides ",*:Ms=\\E]52;c;%p2%s\\7"
# Vi-style copy mode
setw -g mode-keys vi
# Copy mode key bindings
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "$XDG_CONFIG_HOME/tmux/yank.sh"
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "$XDG_CONFIG_HOME/tmux/yank.sh"
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "$XDG_CONFIG_HOME/tmux/yank.sh"
### Status and Window Configuration
# Set the status bar update interval to 1 second
set -g status-interval 1
# Enable automatic renaming of windows
set-option -g automatic-rename on
# Set window title to the current directory if the process is zsh, otherwise show the process name with arguments
set-option -g automatic-rename-format '#{?#{==:#{pane_current_command},zsh},#(echo #{pane_current_path} | sed "s|^$HOME|~|"),#{pane_current_command}}'
# Set the color of the clock mode
set -g clock-mode-colour "#8bd5ca"
# Set the style for copy mode (foreground black, background a specific color, bold text)
set -g mode-style 'fg=black bg=#ed8796 bold'
# Set the style for pane borders
set -g pane-border-style 'fg=white'
set -g pane-active-border-style 'fg=#8bd5ca'
### Status Bar Configuration
# Position the status bar at the bottom
set -g status-position bottom
# Align status bar items to the left
set -g status-justify left
# Set the style for the status bar
set -g status-style 'fg=white,bg=#262626'
# Clear the default left status
set -g status-left ''
# Set the maximum length for the left status
set -g status-left-length 30
# ## Session name in the status bar
# set -ga status-left "#[bg=#444444,fg=white] #S "
# # Display different colors for the session name based on whether the prefix is active
# set -ga status-left '#[fg=black]#{?client_prefix,#[bg=#ed8796] S ,#[bg=#a6da95] S }'
# set -ga status-left '#[bg=#262626] '
# # Set window status format to include the current directory or command
# setw -g window-status-format '#[bg=#8787AF,fg=black] #I #[bg=#585B70,fg=white] #W #F '
# # Set the current window status format to include the current directory or command
# setw -g window-status-current-format '#[bg=#c6a0f6,fg=black] #I #[bg=#585B70,fg=white] #W #F '
# # Set the separator between window statuses
# set -g window-status-separator " "
# # Status bar right settings (display host information)
# set -g status-right "#[fg=black,bg=#7dc4e4] H #[fg=white,bg=brightblack] #H "
# # Set the maximum length for the right status
# set -g status-right-length 40
# Session name and prefix indicator (space always reserved to prevent content shift)
set -ga status-left '#[fg=#cdd6f4,bg=#313244] #S #[fg=#{?client_prefix,#f38ba8,#585b70}]● #[fg=#cdd6f4,bg=#1e1e2e] '
# Window tabs
setw -g window-status-format '#[fg=#cdd6f4,bg=#313244] #I: #W #[fg=#cdd6f4,bg=#1e1e2e] '
setw -g window-status-current-format '#[fg=#1e1e2e,bg=#cba6f7,bold] #I: #W #[fg=#cdd6f4,bg=#1e1e2e,nobold] '
# Set the separator between window statuses
set -g window-status-separator ''
# Status bar right (H local / SSH remote)
set -g status-right ''
set -g status-right-length 50
set -ga status-right '#{?SSH_CONNECTION,#[fg=#1e1e2e#,bg=#fab387#,bold] SSH #[fg=#cdd6f4#,bg=#1e1e2e#,nobold] ,}'
set -ga status-right '#[fg=#1e1e2e,bg=#94e2d5,bold] #H #[fg=#cdd6f4,bg=#1e1e2e,nobold]'