Skip to content

Commit

Permalink
[TMUX] Refactor Config Greatly
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackjacx committed Feb 22, 2024
1 parent 8b2e54e commit fdc97b1
Showing 1 changed file with 84 additions and 40 deletions.
124 changes: 84 additions & 40 deletions bootstrap/config_dirs/tmux/tmux.conf
Original file line number Diff line number Diff line change
@@ -1,33 +1,85 @@
# Some tweaks to the status line
set -g status-right "%H:%M"
set -g window-status-current-style "underscore"

# Status Bar ------------------------------------

set-option -g status-style fg=white,bg=colour04
set-option -g status-justify centre
set-window-option -g window-status-style fg=colour118,bg=colour04
set-window-option -g window-status-current-style fg=black,bold,bg=colour011
set-window-option -g window-status-last-style fg=black,bold,bg=colour011
set-window-option -g window-status-separator |

# Left Side
# Show my active session, window, pane name or id
set-option -g status-left-length 50 # default 10
set-option -g status-left "[#[fg=white]S: #S, #[fg=colour11]W #I-#W, #[fg=colour3]P: #P #[fg=white]]"
# set-option -g status-left-style

# Right Side
set-option -g status-right-length 50 # default 50
set-option -g status-right "#[fg=grey,dim,bg=default] uptime: #(uptime | cut -f 4-5 -d\" \" | cut -f 1 -d\",\")"

# Enable Activity Alerts
set-option -g status-interval 60 # Update the status line every 60 seconds (15 is default)
set-window-option -g monitor-activity on # highlights the window name in the status line

# If running inside tmux ($TMUX is set), then change the status line to red
%if #{TMUX}
set -g status-bg red
%endif

# Change the prefix key to C-a ------------------

set -g prefix C-a
unbind C-b
bind C-a send-prefix

# Visuals ---------------------------------------

set-option -sa terminal-overrides ",xterm*:Tc" # Enable RGB colour if running in xterm(1)
set -g default-terminal "tmux-256color" # Change the default $TERM to tmux-256color
set -g bell-action none # No bells at all
set -g remain-on-exit on # Keep windows around after they exit
set -g status-interval 10 # update status bar every n seconds
set -g set-clipboard on # use system clipboard
set -g renumber-windows on # renumber all windows if any is closed
set -g base-index 1 # Start windows at 1, not 0
setw -g pane-base-index 1 # Start panes at 1, not 0
#setw -g monitor-activity on # Windows with activity are highlighted in the status line
#setw -g monitor-activity on # Windows with activity are highlighted in the status line
set -g visual-activity off # Prevent Tmux from displaying the annoying Activity in window X messages
set-option -g display-time 2000 # By default, status msg disappears in the blink of an eye (750ms)
set-option -g display-panes-time 2000 # By default, pane number disappears in 1 s
set-option -g history-limit 50000 # maximum number of lines held in window history - crank it up from 2k default
# set-option -g lock-after-time 3600 # lock the session after 60 mins of inactivity. Sometimes, it is good to protect your screen to make sure other's can't see enough.
set-option -wg automatic-rename off # default names are too vague to see. Let me name it.

# Change the prefix key to C-a
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# Customize pane divider to make it subtle but distinct.
set-window-option -g pane-border-style fg=colour11,bg=terminal
set-window-option -g pane-active-border-style fg=colour118,bg=terminal

# Cool trick: Let's dim out any pane that's not active.
set-window-option -g window-style fg=white,bg=color236
set-window-option -g window-active-style fg=color254,bg=terminal

# Fix window and pane numbering
set -g renumber-windows on # renumber all windows if any is closed
set -g base-index 1 # Start windows at 1, not 0
setw -g pane-base-index 1 # Start panes at 1, not 0

# Simplify killing a pane (without confirmation)
unbind-key x # unbind-key “x” from it’s current job of “ask and then close”
bind-key x kill-pane # rebind-key it to just “close”

# tmux adds a short, almost imperceptible delay between the commands that can cause funny behavior when running vim inside tmux.
set-option -s escape-time 0

# Key Binding -----------------------------------

# Toggle pane synchronization with Prefix + S
bind S set synchronize-panes
bind C-B set-window-option synchronize-panes
# bind y set synchronize-panes\; display 'synchronize-panes #{?synchronize-panes,on,off}'

# Turn the mouse on
# Clear history with hotkey
# bind -n C-k clear-history
# bind-key b send-keys -R \; clear-history # clears the screen AND the scrollback buffer

# Enable Mouse Support
set -g mouse on
# copy mode dragging
# unbind -n MouseDrag1Pane
Expand All @@ -36,7 +88,10 @@ set -g mouse on

# Bind config reload to `prefix - R`
# unbind -r
bind r source-file ~/.config/tmux/tmux.conf\; display-message "Tmux config reloaded…"
bind r source-file ~/.config/tmux/tmux.conf \; display-message "Config reloaded!"

# Keys to toggle monitoring activity in a window
# bind m set monitor-activity

# Easily resizing panes
bind -r m resize-pane -Z
Expand All @@ -59,10 +114,6 @@ bind F12 selectw -t:21
# multiple places
bind F set -w window-size

# Keys to toggle monitoring activity in a window and the synchronize-panes option
# bind m set monitor-activity
# bind y set synchronize-panes\; display 'synchronize-panes #{?synchronize-panes,on,off}'

# Open windows/panes in current directory
unbind %
bind | split-window -h -c "#{pane_current_path}"
Expand All @@ -83,28 +134,21 @@ bind c new-window -c "#{pane_current_path}"
# neww -d
# neww -d

#-------------------------------------------------------------------------------
# Plugins
#-------------------------------------------------------------------------------

# Source & run tpm package
set -g @plugin 'tmux-plugins/tpm'
# Intall tmux fixes of annoying issues
set -g @plugin 'tmux-plugins/tmux-sensible'
# Catppuccine theme
set -g @plugin 'dreamsofcode-io/catppuccin-tmux'
# Persists tmux environment across system restarts.
set -g @plugin 'tmux-plugins/tmux-resurrect'
# Continuous saving of tmux environment. Automatic restore when tmux is started. Automatic tmux start when computer is turned on.
set -g @plugin 'tmux-plugins/tmux-continuum'
# Use vim key mapping for navigation
set -g @plugin 'christoomey/vim-tmux-navigator'

set -g @resurrect-capture-pane-contents 'on' # allow tmux-ressurect to capture pane contents
set -g @continuum-restore 'on' # enable tmux-continuum functionality

set -g @resurrect-save 'S' # use S for saving current state
set -g @resurrect-restore 'R' # use R for restoring saved state
# Plugins ---------------------------------------

set -g @plugin 'tmux-plugins/tpm' # Source & run tpm package
set -g @plugin 'tmux-plugins/tmux-sensible' # Intall tmux fixes of annoying issues
set -g @plugin 'dreamsofcode-io/catppuccin-tmux' # Catppuccine theme
set -g @plugin 'christoomey/vim-tmux-navigator' # Use vim key mapping for navigation

set -g @plugin 'tmux-plugins/tmux-resurrect' # Persists tmux environment across system restarts.
set -g @resurrect-capture-pane-contents 'on' # allow tmux-ressurect to capture pane contents
set -g @resurrect-dir "${HOME}/.config/tmux/resurrect"
set -g @resurrect-save 'S' # use S for saving current state
set -g @resurrect-restore 'R' # use R for restoring saved state

set -g @plugin 'tmux-plugins/tmux-continuum' # Continuous saving of tmux environment. Automatic restore when tmux is started. Automatic tmux start when computer is turned on.
set -g @continuum-restore 'on' # enable tmux-continuum functionality

# Update plugins install path
set-environment -g TMUX_PLUGIN_MANAGER_PATH "${HOME}/.config/tmux/plugins"
Expand Down

0 comments on commit fdc97b1

Please sign in to comment.