Created
May 29, 2023 23:21
-
-
Save iamhumanipromise/8bbe4587c08108d97f329af179e66372 to your computer and use it in GitHub Desktop.
My Tmux.conf Config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Change the default prefix for tmux commands from "C-b" (Ctrl + b) to "C-a" (Ctrl + a) | |
set-option -g prefix C-a | |
# Unbind the "C-b" key | |
unbind-key C-b | |
# Bind "C-a" as the prefix for sending commands | |
bind-key C-a send-prefix | |
# Enable mouse support in tmux, allowing interactions such as resizing panes | |
set-option -g mouse on | |
# Configure the status bar: background color, foreground color | |
set-option -g status-style "bg=#1C1C1C,fg=#CACACA" | |
# Define the maximum lengths for the left and right sections of the status bar | |
set-option -g status-left-length 60 | |
set-option -g status-right-length 90 | |
# Define what will be displayed on the left section of the status bar | |
# This includes the session, window, and pane IDs, as well as special Unicode characters for aesthetics | |
set-option -g status-left "#[fg=#CACACA]Session: #S #[fg=#FFFFFF]#[fg=#CACACA] Window: #[fg=#FFFFFF]#I | |
#[fg=#CACACA]#[fg=#FFFFFF]#[fg=#CACACA] Pane: #[fg=#FFFFFF]#P" | |
# Define what will be displayed on the right section of the status bar | |
# This includes CPU information and the current date and time | |
set-option -g status-right "#[fg=#CACACA]CPU: #(sysctl -n hw.ncpu) #[fg=#FFFFFF]#[fg=#CACACA] %Y-%m-%d %H:%M " | |
# Configure the status bar for the current window | |
set-window-option -g window-status-current-style "bg=#1C1C1C,fg=#FFFFFF" | |
set-window-option -g window-status-current-format "#[fg=#1C1C1C]#[fg=#FFFFFF] #I #[fg=#1C1C1C]#[fg=#CACACA] #W " | |
# Configure the status bar for other windows | |
set-window-option -g window-status-style "bg=#1C1C1C,fg=#CACACA" | |
set-option -g window-status-format "#[fg=#1C1C1C]#[fg=#CACACA] #I #[fg=#1C1C1C]#[fg=#CACACA] #W " | |
set-window-option -g window-status-separator "" | |
# Define key bindings for BackSpace and Delete keys, enabling specific behavior when these keys are pressed | |
bind-key -n BackSpace send-keys -R\; send-keys C-h | |
bind-key -n Delete send-keys -R\; send-keys C-u | |
# Set default command shell to zsh | |
set-option -g default-command "zsh" | |
# Set the base index for windows and panes to start from 1 instead of 0 | |
set-option -g base-index 1 | |
set-window-option -g pane-base-index 1 | |
# Define d key to run shell with dmenu_run prompt | |
bind-key d run-shell 'dmenu_run -p "Run:"' | |
# Define mouse left click inside pane to run shell with dmenu_run prompt | |
bind-key -n MouseDown1Pane run-shell "dmenu_run -p \"Run:\"" | |
# Create log file for tmux output if it does not exist, and pipe the pane output to the log file | |
run-shell "if [ ! -f ~/.tmux.conf.log ]; then touch ~/.tmux.conf.log; fi" | |
run-shell "tmux pipe-pane -o 'exec cat >> ~/.tmux.conf.log'" | |
# Position the status bar at the top of the screen | |
set-option -g status-position top | |
# Justify the status bar to the right of the screen | |
set-option -g status-justify right | |
# Define the colors for the status bar | |
set-option -g status-style bg=default,fg=white | |
# Set the foreground color of the status bar to colour15 | |
set-option -g status-fg colour15 | |
# Set the background color of the status bar to black | |
set-option -g status-bg black | |
# Set the status bar update interval to 1 second | |
set-option -g status-interval 1 | |
# Define the maximum length for the right section of the status bar | |
set-option -g status-right-length 10 | |
# Define the colors for the command mode prompt | |
set-window-option -g mode-style bg=colour8,fg=white | |
# Define the colors for the message line | |
set-option -g message-style bg=black,fg=white | |
# Set the separator for window titles in the status bar to none | |
setw -g window-status-separator "" | |
# Set the default background color for the status bar | |
set-option -g status-bg default | |
# Specify terminal capabilities that tmux should assume the terminal supports | |
set-option -sa terminal-overrides ",xterm*:Tc" | |
# Set the default terminal for new windows to "tmux-256color" | |
set-option -g default-terminal "tmux-256color" | |
# Set the maximum number of commands to remember in the history | |
set-option -g history-limit 5000 | |
# Turn off the visual bell for alerts | |
set-window-option -g visual-bell off | |
# Set the action to perform when an alert is triggered | |
set-window-option -g bell-action any | |
# Don't keep a window around after the command it's running exits | |
set-option -g remain-on-exit off | |
# Renumber windows sequentially when a window is closed | |
set-option -g renumber-windows on | |
# Show the pane's border status at the top | |
set-window-option -g pane-border-status top | |
# Format the pane border with the current path | |
set-window-option -g pane-border-format "#[align=left]#[fg=dim]─ #{s|$HOME|~|:pane_current_path} ─" | |
# Set the color of the active pane's border | |
set-option -g pane-active-border-style fg=default,bold | |
# Set the color and other styles of the pane border | |
set-option -g pane-border-style fg=colour8,dim,overline | |
# Unbind the "C-b" key again | |
unbind C-b | |
# Bind "C-a" as the prefix for sending commands again | |
bind C-a send-prefix | |
# Bind "C-M-f" to enter copy mode and then search forward | |
bind-key -n C-M-f copy-mode \; send-key ^S | |
# Bind "p" to display a popup window | |
bind p display-popup | |
# Bind "S-right" to swap the current pane with the next pane | |
bind S-right swap-pane -D | |
# Bind "S-left" to swap the current pane with the previous pane | |
bind S-left swap-pane -U | |
# Bind mouse wheel up in copy mode to scroll up two lines | |
bind -T copy-mode WheelUpPane select-pane \; send-keys -X -N 2 scroll-up | |
# Bind mouse wheel down in copy mode to scroll down two lines | |
bind -T copy-mode WheelDownPane select-pane \; send-keys -X -N 2 scroll-down | |
# Bind "m" to toggle monitoring of activity in the current pane | |
bind m set monitor-activity | |
# Bind "y" to synchronize input to all panes in the current window | |
bind y set synchronize-panes\; display 'synchronize-panes #{?synchronize-panes,on,off}' | |
# Create a new detached session with the name of the current user | |
new -d -s $USER |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment