cwonrails
7/11/2016 - 8:39 PM

.tmux.conf

# Free the original Ctrl-b prefix keybinding
unbind C-b

# Reset prefix from Ctrl-b to Ctrl-a
set -g prefix C-a

# Enable Ctrl-a to send input to other apps
bind C-a send-prefix

# Use correct shell on OS X
set -g default-shell /usr/local/bin/bash

# Set the default terminal mode to 256 color mode
set -g default-terminal "screen-256color"

# Set the base index for windows to 1 instead of 0
set -g base-index 1

# Set the base index for panes to 1 instead of 0
set -g pane-base-index 1

# Renumber windows sequentially after closing any of them
set -g renumber-windows on

# Reload .tmux.conf with Prefix R
bind-key R source-file ~/.tmux.conf \; display "Reloaded!"

# Enable vi keys
setw -g mode-keys vi

# Move between panes
bind-key -r h select-pane -L
bind-key -r j select-pane -D
bind-key -r k select-pane -U
bind-key -r l select-pane -R

# Split panes
bind h split-window -h
bind v split-window -v

# Smart pane switching with awareness of vim splits
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"'
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"

# Increase scrollback lines
set -g history-limit 50000

# Resize panes
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5

# Enable native Mac OS X copy/paste
set -g default-command "reattach-to-user-namespace -l /usr/local/bin/bash"

# Use vi mode in command line
set -g @shell_mode 'vi'

set -g @resurrect-capture-pane-contents 'on'
set -g @resurrect-strategy-vim 'session'

# tmux plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'seebi/tmux-colors-solarized'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-sessionist'

# Install tpm if not already installed
if "test ! -d ~/.tmux/plugins/tpm" \
   "run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm'"

run '~/.tmux/plugins/tpm/tpm'