Skip to content

Instantly share code, notes, and snippets.

@csgavino
Created September 21, 2013 08:08
Show Gist options
  • Save csgavino/6648432 to your computer and use it in GitHub Desktop.
Save csgavino/6648432 to your computer and use it in GitHub Desktop.
set -g default-terminal "screen-256color"
set -g history-limit 20000
# reload config
unbind r
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# horizontal and vertical splits
unbind |
bind | split-window -h
unbind _
bind _ split-window
# use ctrl-a instead of ctrl-b
set -g prefix C-a
unbind C-b
bind C-a send-prefix
bind-key a send-prefix
# iterm's open vsplit
unbind C-d
# quick pane cycling
# unbind ^A
# bind -r ^A select-pane -t :.+
# quick window cycling
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
unbind h
bind h select-pane -L
unbind j
bind j select-pane -D
unbind k
bind k select-pane -U
unbind l
bind l select-pane -R
# resize pane
unbind H
bind -r H resize-pane -L 5
unbind J
bind -r J resize-pane -D 5
unbind K
bind -r K resize-pane -U 5
unbind L
bind -r L resize-pane -R 5
# pane
set -g pane-border-fg green
set -g pane-border-bg black
set -g pane-active-border-fg white
# set -g pane-active-border-bg yellow
# status bar
set -g status-interval 1
set -g status-right-length 60
set -g renumber-windows on
set -g base-index 1
setw -g pane-base-index 1
setw -g window-status-current-bg red
setw -g window-status-current-fg white
# http://wiki.gentoo.org/wiki/Tmux
# setw -g window-status-format ' #I:#W '
# setw -g window-status-current-format ' #I:#W '
set -g status-bg black
set -g status-fg white
set -g status-left-length 40
set -g status-left "#[fg=white](#S) "
set -g status-justify left
set -g status-right ""
# monitor windows
setw -g monitor-activity on
set -g visual-activity on
setw -g utf8 on
set -g status-utf8 on
setw -g automatic-rename
# tile all windows
unbind =
bind = select-layout tiled
# sane scrolling
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
# enables mouse support
set-option -g mouse-select-pane on
set-option -g mouse-resize-pane on
set-option -g mouse-select-window on
set-window-option -g mode-mouse on
set -sg escape-time 0
# vim copy mode (http://jasonwryan.com/blog/2011/06/07/copy-and-paste-in-tmux/)
setw -g mode-keys vi
unbind [
bind Escape copy-mode
unbind p
bind p paste-buffer
bind -t vi-copy 'v' begin-selection
bind -t vi-copy 'y' copy-pipe 'reattach-to-user-namespace pbcopy'
unbind -t vi-copy Enter
bind -t vi-copy Enter copy-pipe 'reattach-to-user-namespace pbcopy'
# maximizes current pane
unbind Up
bind Up new-window -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp
# minimizes current pane
unbind Down
bind Down last-window \; swap-pane -s tmp.1 \; kill-window -t tmp
# smart pane switching with awareness of vim splits (https://github.com/christoomey/vim-tmux-navigator)
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R"
bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys 'C-\\') || tmux select-pane -l"
# http://stackoverflow.com/questions/10158508/lose-vim-colorscheme-in-tmux-mode
set -g default-terminal "xterm-256color"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment