set -s default-terminal screen-256color
set -s history-file ~/.tmux_history
set -s escape-time 0
set -g default-command "${SHELL}"
set -g history-limit 100000
set -g destroy-unattached off
set -g mouse on
set -g base-index 1
set -g display-time 3000
set -g focus-events on
set -g renumber-windows on
set -g set-titles on
set -g set-titles-string "#{session_name}: [#{window_name}] #{pane_current_path}"
set -g terminal-overrides ',xterm*:Cr=\E]12;green\007:XT,rxvt*:Cr=\E]12;green\007:XT'
set -g status on
set -g status-keys vi
set -g status-interval 5
set -g status-justify left
set -g status-position bottom
set -wg mode-keys vi
set -wg xterm-keys on
set -wg monitor-bell on
set -wg alternate-screen on
set -wg automatic-rename on
set -wg word-separators ' ()<>[]{}|=,;:&?*@^"'
set -wg clock-mode-colour green
# Colors
set -g status-style "bg=#000000"
set -g message-command-style "bg=#000000,fg=#00d700"
set -g message-style "fg=#000000,bg=#00d700"
set -g mode-style "fg=#ff0000,bold"
set -g pane-border-style 'fg=#ffffff'
set -g pane-active-border-style 'fg=#ff0000'
set -g status-left ' #[fg=#ff0000,bold]#S:#[default]'
set -g window-status-format ' #[fg=#b2b2b2]#I-#W#[fg=#ffff00,bold]#F#[fg=#000000]#[default]'
set -g window-status-current-format ' #[fg=#005fff,bold]#I-#W#F#[default]'
set -g window-status-bell-fg "#ffffff"
set -g window-status-bell-bg "#ff0000"
set -g status-right '#[fg=#ffd700,bold] #(sysctl vm.loadavg | cut -d \ -f 3-5) #[default]'
# Keybindings
# use ctrl+space as prefix and ctrl+a as prefix for second tmux session
set -g prefix C-space
bind-key -n C-a send-prefix
unbind C-b
# reload tmux configuration with prefix+r
bind r source ~/.tmux.conf\; display ' Configuration RELOADED'
# split panes with prefix+v or h using current path
bind v split-window -h -c "#{pane_current_path}"
bind h split-window -v -c "#{pane_current_path}"
# prefix+N to create new session
bind N new-session
# prefix+d to close current tab
bind d kill-window
# prefix+k/K to kill current/all except current session
bind k kill-session
bind K kill-session -a
# prefix+m to turn on/off mouse
bind m set-option -g mouse\; display ' Mouse #{?mouse,ENABLED,DISABLED}'
# prefix+/ to search
bind / copy-mode\; send-key ?
# alt+shift+up/down to create new/close tab
bind -n M-S-up new-window
bind -n M-S-down kill-window
# alt+shift+left/right to select prev/next tab
bind -n M-S-left prev
bind -n M-S-right next
# ctrl+shift+left/right to move tab
bind -n C-S-left swap-window -t -1
bind -n C-S-right swap-window -t +1
# ctrl+shift+pageup/pgdown to move tabs
bind -n C-S-Pageup swap-window -t -1
bind -n C-S-Pagedown swap-window -t +1
# ctrl+alt+n/s to create/select session
bind -n C-M-n new-session
bind -n C-M-s choose-session
# ctrl+alt+t/w to create new/close tab
bind -n C-M-t new-window
bind -n C-M-w kill-window
# ctrl+alt+pageup/pgdown to scroll tabs
bind -n C-M-Pageup prev
bind -n C-M-Pagedown next
# ctrl+alt+a to toggle status line
bind -n C-M-a set -g status
# copy tmux selection to PRIMARY when selecting with mouse
bind -T copy-mode-vi MouseDragEnd1Pane select-pane\; send-keys -X copy-pipe 'xclip -in -selection primary'
bind -T copy-mode-vi DoubleClick1Pane select-pane\; send-keys -X select-word\; send-keys -X copy-pipe 'xclip -in -selection primary'
bind -T copy-mode-vi TripleClick1Pane select-pane\; send-keys -X select-line\; send-keys -X copy-pipe 'xclip -in -selection primary'
# mouse wheel scroll clears selection
bind -T copy-mode-vi WheelUpPane send-keys -X clear-selection\; send-keys -X -N 3 scroll-up
bind -T copy-mode-vi WheelDownPane send-keys -X clear-selection\; send-keys -X -N 3 scroll-down
# clear selection (and move cursor) with left click
bind -T copy-mode-vi MouseDown1Pane select-pane \; send-keys -X clear-selection
# paste tmux selection with middle click
bind -T root MouseDown2Pane paste-buffer
# v - start selection and auto copy it to PRIMARY
bind -T copy-mode-vi v send-keys -X copy-pipe 'xclip -in -selection primary'\; send-keys -X begin-selection
# y - copy to CLIPBOARD when in copy mode
bind -T copy-mode-vi y send-keys -X copy-pipe 'xclip -in -selection clipboard'\; send-keys -X clear-selection
# q - quit copy mode
bind -T copy-mode-vi q send-keys -X cancel
# escape - clear selection in copy mode
bind -T copy-mode-vi Escape send-keys -X clear-selection
# home & end in copy mode
bind -T copy-mode-vi Home send -X start-of-line
bind -T copy-mode-vi End send -X end-of-line
# ctrl+right/left in copy mode
bind -T copy-mode-vi C-Right send-keys -X next-word
bind -T copy-mode-vi C-Left send-keys -X previous-word