Adding the readme, bwrate script and the normal and powerline versions

of the tmux config.
This commit is contained in:
Kevin 2014-04-09 14:30:31 -04:00
parent b4ba1c3300
commit 5b77a6002e
4 changed files with 339 additions and 3 deletions

View file

@ -1,4 +1,39 @@
darkcloud-tmuxconfig
====================
# Darkcloud TMUX Config
A tmux config that includes key mappings, bandwidth monitoring in the status line and a dark theme designed around the one used in darkcloud-vimconfig.
## Features ##
* A custom theme that matches the one used in [darkcloud-vimconfig](https://github.com/prurigro/darkcloud-vimconfig).
* A bandwidth monitor showing the current upload and download speed of either eth0 or the device you've set to $NETDEV.
* Sane defaults and a set of custom key bindings that group similar ideas and make frequently used commands easier to access.
* Optional support for powerline fonts that looks oh so much better when they're used :).
## Installation ##
1. Choose either **tmux.powerline.conf** if powerline fonts are available or **tmux.normal.conf** if they're not, and install it to __/etc/tmux.conf__ for a system-wide install or __~/.tmux.conf__ for a local install.
2. Install **bwrate** to somewhere available in **$PATH** and make it executable (ie: `install -Dm755 bwrate /usr/local/bin/bwrate`)
3. If your network device isn't named **eth0**, set **$NETDEV** to the name of the device you'd like to use somewhere tmux will see it when it runs (ie: `echo 'export $NETDEV="wlan0" >> ~/.bashrc'`)
## Key Bindings ##
* **Prefix**: Ctrl-Space
* **m** and **Ctrl-m**: Toggle mouse mode on and off respectively.
* **\** and **Ctrl-\**: Toggle the status bar on and off respectively.
* **c** and **Ctrl-c**: Create a new pane (with repetition) and create a new pane in the current directory (with repetition) respectively.
* **[** and **]**: Split the window vertically and horizontally respectively.
* **{** and **}**: Rotate the window up and down respectively.
* **=** and **-**: Select an even layout horizontally and vertically respectively.
* **=** and **-**: Select a main layout horizontally and vertically respectively.
* **Space** and **Ctrl-Space**: Move to the previously selected window and pane respectively.
* **h**, **j**, **k** and **l**: Move left, down, up and right between panes respectively like the arrow keys.
* **`**: Toggle synchronized input between the panes on the current window.
* **Escape**: Clear the terminal history, tmux history and the current window/pane.
* **?** and **/**: Show help for available key bindings and commands respectively.
* **y** and **Ctrl-p**: Enter __copy mode__ and paste from the copy buffer respectively.
* (__copy mode__) **v**, **y** and **Escape**: Begin selection, copy selection and cancel __copy mode__ respectively.
## Credits ##
* Written by prurigro: [GitHub Projects](https://github.com/prurigro) | [Arch Linux AUR Packages](https://aur.archlinux.org/packages/?SeB=m&K=prurigro)
## License ##
This config and the bwrate script are released under the MIT license.

27
bwrate Executable file
View file

@ -0,0 +1,27 @@
#!/usr/bin/env bash
TIMESPAN=1
if [ -z $1 ]; then
echo "Error: no device specified"
exit 1
fi
if [ ! -d /sys/class/net/$1 ]; then
echo "No such device: $1"
exit 1
fi
BR1=`cat /sys/class/net/$1/statistics/rx_bytes`
BT1=`cat /sys/class/net/$1/statistics/tx_bytes`
sleep $TIMESPAN
BR2=`cat /sys/class/net/$1/statistics/rx_bytes`
BT2=`cat /sys/class/net/$1/statistics/tx_bytes`
DOWNKB=$(((($BR2-$BR1) / $TIMESPAN) /1024))
UPKB=$(((($BT2-$BT1) / $TIMESPAN) /1024))
echo "D ${DOWNKB}KB/s | U ${UPKB}KB/s"
exit 0

137
tmux.normal.conf Normal file
View file

@ -0,0 +1,137 @@
#
# DARKCLOUD TMUX CONFIG: tmux.conf
#
# Maintainer: Prurigro (prurigro-at-gmail-dot-com)
# Website: https://github.com/prurigro/darkcloud-tmuxconfig
#
# License: MIT
#
# Notes:
#
# The status bar shows traffic for the eth0 network device by default.
# To use a different device, set $NETDEV to it's device name (eg: wlan0).
#
# PRECONFIG
#
# unbind the command prefix and set the new one to ctrl-Space
unbind C-b
set-option -g prefix C-Space
bind Space send-prefix
# SETTINGS
#
# general
set-option -g default-terminal "screen-256color" #set $TERM to screen-256color for compatibility with programs expecting colour
set-option -g renumber-windows on #when a window is closed, renumber the remaining windows
set-option -g set-titles on #attempt to set the terminal title
set-option -g set-titles-string "#I:#P - #W - #T" #string used to set the terminal title
set-option -g history-limit 10000 #maximum number of lines kept in history
set-option -g display-time 2000 #number of ms for status line messages and other on-screen indicators to display
set-option -g display-panes-time 2000 #number of ms to show indicators from the display-panes command
set-option -sg escape-time 0 #allow commands immediately following send-prefix
set-option -sg repeat-time 600 #allow 600ms between repeatable commands
set-window-option -g utf8 on #expect to display utf8 in the window
set-window-option -g aggressive-resize on #only resize a window if a smaller client is actively looking
set-window-option -g monitor-activity on #monitor for activity in windows
set-window-option -g visual-activity off #show the activity being monitored for in the status bar
set-window-option -g xterm-keys on #generate xterm-style function key sequences for better compatibility
set-window-option -g mode-keys vi #use vi-style keys in copy and choice modes
#
# mouse
set-option -g mode-mouse on
set-option -g mouse-utf8 on
set-option -g mouse-resize-pane on
set-option -g mouse-select-pane on
set-option -g mouse-select-window on
# KEY BINDINGS
#
# m and ctrl-m to enabling and disabling the mouse respectively
bind m set-option -g mode-mouse on \; set-option -g mouse-resize-pane on \; set-option -g mouse-select-pane on \; set-option -g mouse-select-window on \; display 'Mouse: ON'
bind C-m set-option -g mode-mouse off \; set-option -g mouse-resize-pane off \; set-option -g mouse-select-pane off \; set-option -g mouse-select-window off \; display 'Mouse: OFF'
#
# r and ctrl-r to reloading ~/.tmux.conf and /etc/tmux.conf respectively
bind r source-file ~/.tmux.conf
bind C-r source-file /etc/tmux.conf
#
# \ and ctrl-\ to enabling and disabling the status bar respectively
bind \ set-option -g status on
bind C-\ set-option -g status off
#
# c and ctrl-c to create a new pane in home and at the current path respectively (with repetition)
bind -r c new-window
bind -r C-c new-window -c '#{pane_current_path}'
#
# [ and ] to splitting the window into top/bottom and left/right respectively
bind -r [ split-window -v -c '#{pane_current_path}'
bind -r ] split-window -h -c '#{pane_current_path}'
#
# { and } to rotating up and down respectively
bind -r { rotate-window -U
bind -r } rotate-window -D
#
# = and - to evenly laying out the panes left->right and top->bottom respectively
bind = select-layout even-horizontal
bind - select-layout even-vertical
#
# + and _ to vertically/horizontally laying out the panes with one large one on the top/left respectively
bind + select-layout main-horizontal
bind _ select-layout main-vertical
#
# Space and ctrl-Space to navigating to the previously selected pane and window respectively
bind Space last-pane
bind C-Space last-window
#
# h,j,k,l to movement left,down,up,right between panes respectively
bind -r h select-pane -L
bind -r j select-pane -D
bind -r k select-pane -U
bind -r l select-pane -R
#
# ~ to synchronous panes
bind ` set-window-option synchronize-panes \; display 'Toggling pane synchronization'
#
# escape to clearing history and screen
bind Escape send-keys -R\; send-keys 'C-l'\; clear-history
#
# ? and ctrl-? to keyboard and command help respectively
bind ? list-keys
bind / list-commands
#
# y and ctrl-p to copy mode and pasting the copy buffer respectively
bind y copy-mode
bind C-p paste-buffer
#
# (copy mode) v,y and escape to select, copy and cancel respectively
bind -t vi-copy y copy-selection
bind -t vi-copy v begin-selection
bind -t vi-copy Escape cancel
# STATUS LINE
#
# settings
set-option -g status on #enable the status bar
set-option -g status-utf8 on #expect to display utf8 in the status bar
set-option -g status-interval 2 #the number of seconds to wait before refreshing
set-option -g status-justify left #justify the window list on the left
set-option -g status-left-length '100' #the width in characters of the left side of the status line
set-option -g status-right-length '100' #the width in characters of the right side of the status line
set-window-option -g window-status-separator '' #the character to separate entries of the status line with
#
# general theme
set-option -g status-style bg=colour236
set-option -g message-style bg=colour235,fg=colour254,bold
set-option -g message-command-style fg=colour253,bg=colour235
set-option -g pane-border-style fg=colour235
set-option -g pane-active-border-style fg=colour167
set-window-option -g window-status-style fg=colour255,bg=colour236
set-window-option -g window-status-activity-style fg=colour167,bold
#
# theme for active and inactive window titles respectively
set-window-option -g window-status-format '#[fg=colour255,bg=colour236] #I #[fg=colour117,bg=colour236,nobold,nounderscore,noitalics]|#[fg=colour255,bg=colour236] #W '
set-window-option -g window-status-current-format ' #I #[fg=colour167,bg=colour235,bold,nounderscore,noitalics]|#[fg=colour253,bg=colour235,bold] #W '
#
# theme for the left and right sides respectively
set-option -g status-left '#[fg=colour117,bg=colour235,bold] #S '
set-option -g status-right '#[fg=colour222,bg=colour235] #([[ -n "$NETDEV" ]] && bwrate $NETDEV || bwrate eth0) #[fg=colour117,bg=colour236] %H:%M %Y-%m-%d #[fg=colour167,bg=colour235] #h '

137
tmux.powerline.conf Normal file
View file

@ -0,0 +1,137 @@
#
# DARKCLOUD TMUX CONFIG: tmux.conf
#
# Maintainer: Prurigro (prurigro-at-gmail-dot-com)
# Website: https://github.com/prurigro/darkcloud-tmuxconfig
#
# License: MIT
#
# Notes:
#
# The status bar shows traffic for the eth0 network device by default.
# To use a different device, set $NETDEV to it's device name (eg: wlan0).
#
# PRECONFIG
#
# unbind the command prefix and set the new one to ctrl-Space
unbind C-b
set-option -g prefix C-Space
bind Space send-prefix
# SETTINGS
#
# general
set-option -g default-terminal "screen-256color" #set $TERM to screen-256color for compatibility with programs expecting colour
set-option -g renumber-windows on #when a window is closed, renumber the remaining windows
set-option -g set-titles on #attempt to set the terminal title
set-option -g set-titles-string "#I:#P - #W - #T" #string used to set the terminal title
set-option -g history-limit 10000 #maximum number of lines kept in history
set-option -g display-time 2000 #number of ms for status line messages and other on-screen indicators to display
set-option -g display-panes-time 2000 #number of ms to show indicators from the display-panes command
set-option -sg escape-time 0 #allow commands immediately following send-prefix
set-option -sg repeat-time 600 #allow 600ms between repeatable commands
set-window-option -g utf8 on #expect to display utf8 in the window
set-window-option -g aggressive-resize on #only resize a window if a smaller client is actively looking
set-window-option -g monitor-activity on #monitor for activity in windows
set-window-option -g visual-activity off #show the activity being monitored for in the status bar
set-window-option -g xterm-keys on #generate xterm-style function key sequences for better compatibility
set-window-option -g mode-keys vi #use vi-style keys in copy and choice modes
#
# mouse
set-option -g mode-mouse on
set-option -g mouse-utf8 on
set-option -g mouse-resize-pane on
set-option -g mouse-select-pane on
set-option -g mouse-select-window on
# KEY BINDINGS
#
# m and ctrl-m to enabling and disabling the mouse respectively
bind m set-option -g mode-mouse on \; set-option -g mouse-resize-pane on \; set-option -g mouse-select-pane on \; set-option -g mouse-select-window on \; display 'Mouse: ON'
bind C-m set-option -g mode-mouse off \; set-option -g mouse-resize-pane off \; set-option -g mouse-select-pane off \; set-option -g mouse-select-window off \; display 'Mouse: OFF'
#
# r and ctrl-r to reloading ~/.tmux.conf and /etc/tmux.conf respectively
bind r source-file ~/.tmux.conf
bind C-r source-file /etc/tmux.conf
#
# \ and ctrl-\ to enabling and disabling the status bar respectively
bind \ set-option -g status on
bind C-\ set-option -g status off
#
# c and ctrl-c to create a new pane in home and at the current path respectively (with repetition)
bind -r c new-window
bind -r C-c new-window -c '#{pane_current_path}'
#
# [ and ] to splitting the window into top/bottom and left/right respectively
bind -r [ split-window -v -c '#{pane_current_path}'
bind -r ] split-window -h -c '#{pane_current_path}'
#
# { and } to rotating up and down respectively
bind -r { rotate-window -U
bind -r } rotate-window -D
#
# = and - to evenly laying out the panes left->right and top->bottom respectively
bind = select-layout even-horizontal
bind - select-layout even-vertical
#
# + and _ to vertically/horizontally laying out the panes with one large one on the top/left respectively
bind + select-layout main-horizontal
bind _ select-layout main-vertical
#
# Space and ctrl-Space to navigating to the previously selected pane and window respectively
bind Space last-pane
bind C-Space last-window
#
# h,j,k,l to movement left,down,up,right between panes respectively
bind -r h select-pane -L
bind -r j select-pane -D
bind -r k select-pane -U
bind -r l select-pane -R
#
# ~ to synchronous panes
bind ` set-window-option synchronize-panes \; display 'Toggling pane synchronization'
#
# escape to clearing history and screen
bind Escape send-keys -R\; send-keys 'C-l'\; clear-history
#
# ? and ctrl-? to keyboard and command help respectively
bind ? list-keys
bind / list-commands
#
# y and ctrl-p to copy mode and pasting the copy buffer respectively
bind y copy-mode
bind C-p paste-buffer
#
# (copy mode) v,y and escape to select, copy and cancel respectively
bind -t vi-copy y copy-selection
bind -t vi-copy v begin-selection
bind -t vi-copy Escape cancel
# STATUS LINE
#
# settings
set-option -g status on #enable the status bar
set-option -g status-utf8 on #expect to display utf8 in the status bar
set-option -g status-interval 2 #the number of seconds to wait before refreshing
set-option -g status-justify left #justify the window list on the left
set-option -g status-left-length '100' #the width in characters of the left side of the status line
set-option -g status-right-length '100' #the width in characters of the right side of the status line
set-window-option -g window-status-separator '' #the character to separate entries of the status line with
#
# general theme
set-option -g status-style bg=colour236
set-option -g message-style bg=colour235,fg=colour254,bold
set-option -g message-command-style fg=colour253,bg=colour235
set-option -g pane-border-style fg=colour235
set-option -g pane-active-border-style fg=colour167
set-window-option -g window-status-style fg=colour255,bg=colour236
set-window-option -g window-status-activity-style fg=colour167,bold
#
# theme for active and inactive window titles respectively
set-window-option -g window-status-current-format '#[fg=colour236,bg=colour235,nobold,nounderscore,noitalics]#[fg=colour253,bg=colour235,bold] #I #[fg=colour167,bg=colour235,bold,nounderscore,noitalics]#[fg=colour253,bg=colour235,bold] #W #[fg=colour235,bg=colour236,nobold,nounderscore,noitalics]'
set-window-option -g window-status-format ' #I #[fg=colour117,bg=colour236,nobold,nounderscore,noitalics]#[fg=colour255,bg=colour236] #W '
#
# theme for the left and right sides respectively
set-option -g status-left '#[fg=colour117,bg=colour235,bold] #S #[fg=colour235,bg=colour236,nobold,nounderscore,noitalics]'
set-option -g status-right '#[fg=colour235,bg=colour236,nobold,nounderscore,noitalics]#[fg=colour222,bg=colour235] #([[ -n "$NETDEV" ]] && bwrate $NETDEV || bwrate eth0) #[fg=colour236,bg=colour235,nobold,nounderscore,noitalics]#[fg=colour117,bg=colour236] %H:%M %Y-%m-%d #[fg=colour235,bg=colour236,nobold,nounderscore,noitalics]#[fg=colour167,bg=colour235] #h '