darkcloud-tmuxconfig/tmux.powerline.conf
2016-04-20 22:50:42 -04:00

170 lines
7.9 KiB
Text

#
# 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 variable so programs know how to behave
set-option -g base-index 1 #start counting windows at 1 instead of 0 (for more logical keboard-switching)
set-option -g pane-base-index 1 #start counting panes at 1 instead of 0
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 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 mouse on
bind -T root MouseDown3Pane send-keys -M #send right clicks to the application below
# KEY BINDINGS
#
# m and <ctrl>m to enabling and disabling the mouse respectively
bind m set-option -g mouse on \; display 'Mouse: ON'
bind C-m set-option -g mouse off \; display 'Mouse: OFF'
#
# r and <ctrl>r to reloading ~/.tmux.conf and /etc/tmux.conf respectively
bind r source-file ~/.tmux.conf
bind 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 the current path and in home respectively
bind C-c new-window -c "#{pane_current_path}"
bind c new-window
#
# [ and ] to splitting the window into top/bottom and left/right respectively
bind [ split-window -v -c "#{pane_current_path}"
bind ] split-window -h -c "#{pane_current_path}"
#
# { and } join another window as a pane split top/bottom and left/right respectively
bind { choose-window 'join-pane -v -s "%%"'
bind } choose-window 'join-pane -h -s "%%"'
#
# - and = to evenly laying out the panes top->bottom and left->right respectively
bind - select-layout even-vertical
bind = select-layout even-horizontal
#
# _ and + to rotate counter-clockwise and clockwise respectively
bind -r _ rotate-window -U
bind -r + rotate-window -D
#
# < and > to move the current window to the first and last windows respectively
bind < run-shell "while [[ ! $(tmux list-windows | grep -e '(active)$' | sed 's|:.*$||') = 1 ]]; do tmux swap-window -s $(tmux list-windows | grep -e '(active)$' | sed 's|:.*$||') -t $(expr $(tmux list-windows | grep -e '(active)$' | sed 's|:.*$||') - 1); done"
bind > run-shell "while [[ ! $(tmux list-windows | grep -e '(active)$' | sed 's|:.*$||') = $(tmux list-windows | tail -n 1 | sed 's|:.*$||') ]]; do tmux swap-window -s $(tmux list-windows | grep -e '(active)$' | sed 's|:.*$||') -t $(expr $(tmux list-windows | grep -e '(active)$' | sed 's|:.*$||') + 1); done"
#
# . and , to move and swap the current window respectively (. is set by default)
bind , command-prompt "swap-window -t '%%'"
#
# $ and # to rename the session and current window respectively ($ is set by default)
bind "#" command-prompt -I '#W' "rename-window '%%'"
#
# Space and <ctrl>Space to navigating to the previously selected window and pane respectively
bind Space last-window
bind C-Space last-pane
#
# rebind up,down,left,right to the same without repeat
bind Left select-pane -L
bind Down select-pane -D
bind Up select-pane -U
bind Right select-pane -R
#
# h,j,k,l to movement left,down,up,right between panes respectively
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
#
# ~ to synchronous panes
bind ` set-window-option synchronize-panes \; display "synchronize-panes: toggled"
#
# escape to clearing history and screen
bind C-r 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
#
# C-v and C-y to paste the X buffer, or copy the tmux buffer into X
bind C-v run "xclip -o | tmux load-buffer - ; tmux paste-buffer"
bind C-y run "tmux show-buffer | xclip -sel clip"
#
# (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
#
# bind <alt>[0-9] to switching directly to the respective window
bind -n M-1 select-window -t 1
bind -n M-2 select-window -t 2
bind -n M-3 select-window -t 3
bind -n M-4 select-window -t 4
bind -n M-5 select-window -t 5
bind -n M-6 select-window -t 6
bind -n M-7 select-window -t 7
bind -n M-8 select-window -t 8
bind -n M-9 select-window -t 9
bind -n M-0 select-window -t 10
#
# save scrollback to file
bind-key W command-prompt -p 'write scrollback to file:' -I '~/tmux-history.txt' 'capture-pane -S -32768 ; save-buffer %1 ; delete-buffer'
# STATUS LINE
#
# settings
set-option -g status on #enable 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-window-option -g pane-border-style fg=colour235
set-window-option -g pane-active-border-style fg=colour255
set-window-option -g window-status-style fg=colour255,bg=colour236
set-window-option -g window-status-activity-style fg=colour222,bold
set-window-option -g window-status-bell-style fg=colour222,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 '