Skip to content

Instantly share code, notes, and snippets.

@cfsanderson-fulcrum
Last active March 16, 2022 17:32
Show Gist options
  • Save cfsanderson-fulcrum/a87d7ff6c0e50899f444e049773c0f08 to your computer and use it in GitHub Desktop.
Save cfsanderson-fulcrum/a87d7ff6c0e50899f444e049773c0f08 to your computer and use it in GitHub Desktop.
Tmux configuration with status line and tmux-mem-cpu-load
#==============================================================================
# __
# / /_____ ___ __ ___ __
# / __/ __ `__ \/ / / / |/_/
# / /_/ / / / / / /_/ /> <
# \__/_/ /_/ /_/\__,_/_/|_|
#
#==============================================================================
# @cfsanderson
# set colors
set-option default-terminal "tmux-256color"
set-option -a terminal-overrides ",*256col*:RGB"
# set scrollback with shift + pageup/pagedown
set -ga terminal-overrides ',*256color*:smcup@:rmcup@'
# it would be nice to get powerline working in tmux with something like below
# source "/usr/lib/python3.8/site-packages/powerline/bindings/tmux/powerline.conf"
# set focus-events (nvim :checkhealth recommend
set-option -g focus-events on
# Setting the prefix from C-b to C-a
set -g prefix C-a
# Free the original Ctrl-b prefix keybinding
unbind C-b
# Setting the delay between prefix and command
set -s escape-time 3
# Set the base index for windows to 1 instead of 0
set -g base-index 1
# Set the base index for panes to 1 instead of 0
setw -g pane-base-index 1
# Switch to last window
unbind l
bind-key C-a last-window
unbind o
bind-key C-a select-pane
# Reload the file with Prefix r
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# Splitting panes replace % and "
bind u split-window -h
bind i split-window -v
unbind '"'
unbind %
# moving between panes
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# status line conf from https://arcolinux.com/everything-you-need-to-know-about-tmux-status-bar/
set-option -g status on
set-option -g status-interval 1
set-option -g status-justify left
set-option -g status-keys vi
set-option -g status-position bottom
#set-option -g status-style fg=colour166,bg=colour235
set-option -g status-style fg=brightcyan,bg=colour0
#set-option -g status-style fg=cyan,bright,bg=colour0
# Currently used memory, available memory, CPU usage bar graph, CPU usage percentage, Load average for the past minute, Load average for the past 5 minutes, Load average for the past 15 minutes,
# requires `brew install tmux-mem-cpu-load`
set-option -g status-right-length 140
set-option -g status-right-style default
set-option -g status-right "#[fg=green,bg=default,bright]#(tmux-mem-cpu-load) "
set-option -ag status-right "#[fg=red,dim,bg=default]#(uptime | cut -f 4-5 -d ' ' | cut -f 1 -d ',') "
# set-window-option -g window-status-style fg=colour244
# set-window-option -g window-status-style bg=black
# set-window-option -g window-status-current-style fg=colour166
# set-window-option -g window-status-current-style bg=default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment