Skip to content

Instantly share code, notes, and snippets.

@scrooloose
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scrooloose/fc57b3cd82a7f0bad228 to your computer and use it in GitHub Desktop.
Save scrooloose/fc57b3cd82a7f0bad228 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ -f /tmp/tmux-cpu ]; then
cat /tmp/tmux-cpu
else
echo "???"
fi
CPU=`mpstat 1 1` && echo $CPU | awk '{printf("%2.f", $(NF-8) + $(NF-6)) }' > /tmp/tmux-cpu &
#!/bin/bash
if [ -f /tmp/tmux-io ]; then
io=`cat /tmp/tmux-io`
if [ "$io" -gt "75" ]; then
echo "hi"
elif [ "$io" -gt "20" ]; then
echo "me"
elif [ "$io" -gt "10" ]; then
echo "lo"
else
echo "--"
fi
else
echo "??"
fi
IO=`iostat -x -d 1 2` && echo $IO | awk '{printf("%d", $(NF)) }' > /tmp/tmux-io &
#!/bin/bash
cut -d " " -f 1-3 /proc/loadavg
#!/bin/bash
free -m | awk 'NR==3 { printf("%d\n", ($3/($3+$4)) * 100) }'
# 256 color
set -g default-terminal "screen-256color"
# prefix key
unbind C-b
set -g prefix ^a
# screen-like
bind ^C new-window
bind ^D detach-client
bind ^N next-window
bind ^P previous-window
bind ^K confirm-before -p "kill-window #S? (y/n)" kill-window
bind ^O last-window
bind ^A last-window
# Automatically set window title
setw -g automatic-rename on
# Allows for faster key repetition
set -g repeat-time 0
# copy selection color
setw -g mode-fg black
setw -g mode-bg green
# alert message line
set -g message-fg black
set -g message-bg green
# status line
set -g status-interval 2
set -g status-bg blue
set -g status-fg white
set -g status-left " "
set -g status-right '#[fg=white bg=black]Mem use:#($HOME/.tmux/statusline_helpers/mem_used.sh)% #[fg=green]IO:#($HOME/.tmux/statusline_helpers/io.sh) #[fg=yellow,bright]CPU:#($HOME/.tmux/statusline_helpers/cpu.sh)% #[fg=white,bright bg=red] #($HOME/.tmux/statusline_helpers/load.sh) #[default] #[fg=yellow,bright]%Y.%m.%d #[fg=green]%H:%M #[default]'
set -g status-right-length 100
setw -g window-status-current-fg white
setw -g window-status-current-bg black
setw -g window-status-current-format "[#I#F#W]"
setw -g window-status-format " #I#F#W "
#setw -g window-status-alert-fg black
#setw -g window-status-alert-bg white
#setw -g window-status-alert-attr default
# border
set -g pane-border-fg blue
set -g pane-border-bg black
set -g pane-active-border-fg blue
set -g pane-active-border-bg blue
# split
bind | split-window -h
bind _ split-window -v
# mouse
set -g mode-mouse on
set -g mouse-resize-pane on
set -g mouse-select-pane on
set -g mouse-select-window on
setw -g aggressive-resize on
set -g history-limit 1000000
# vim copy selection
bind-key ESCAPE copy-mode
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection
# move around panes with hjkl, as one would in vim after pressing ctrl-w
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind ^H select-pane -L
bind ^J select-pane -D
bind ^K select-pane -U
bind ^L select-pane -R
# vi-style controls for copy mode
setw -g mode-keys vi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment