Skip to content

Instantly share code, notes, and snippets.

@meotimdihia
Last active April 6, 2021 09:35
Show Gist options
  • Save meotimdihia/55e8cd9719677f1375c81ea456632fda to your computer and use it in GitHub Desktop.
Save meotimdihia/55e8cd9719677f1375c81ea456632fda to your computer and use it in GitHub Desktop.
Simple tmux v3.0+ config, show CPU, memory usage.

screenshot

# https://www.medo64.com/2020/01/colored-cpu-usage-in-tmux/
# https://gist.github.com/spicycode/1229612

# remap prefix to Control + a
set -g prefix C-a

# bind 'C-a C-a' to type 'C-a'
bind C-a send-prefix
unbind C-b


set-window-option -g status-right ' #( vmstat 1 2 | tail -1 | awk "{ USAGE=100-\$15; if (USAGE < 20) { printf \"#[fg=black]\"; } else if (USAGE < 80) { printf \"#[bg=yellow,fg=black]\"; } else { printf \"#[bg=red,fg=white]\"; }; print \" \" USAGE \"% \" }" ) \  
#(free -m  | awk "NR==2" | awk "{USAGE=(\$2-\$7)/\$2*100; if (USAGE < 60) { printf \"#[fg=black]\"; } else if (USAGE < 80) { printf \"#[bg=yellow,fg=black]\"; } else { printf \"#[bg=red,fg=white]\"; }; print int(USAGE)\"%\"}") \  
#[bg=green,fg=black] #(cut -d " " -f 1-3 /proc/loadavg) #(date +%T)'  

set -g mouse on

bind r source-file ~/.tmux.conf
setw -g monitor-activity on

# Use Alt-arrow keys without prefix key to switch panes

bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D

# Shift arrow to switch windows
bind -n S-Left  previous-window
bind -n S-Right next-window

# No delay for escape key press
set -sg escape-time 0

# THEME

set -g window-status-current-style bg=blue,fg=white,bold

set -g status-interval 5
set -g status-left-length 30
set -g status-left '#[fg=black,bright](#S)#(whoami) '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment