Skip to content

Instantly share code, notes, and snippets.

@mackjoner
Forked from spikegrobstein/tmux.conf
Created February 23, 2016 10:05
Show Gist options
  • Save mackjoner/2c94567b5f3c1dcbbac2 to your computer and use it in GitHub Desktop.
Save mackjoner/2c94567b5f3c1dcbbac2 to your computer and use it in GitHub Desktop.
my tmux config (updated for 2.1)
# This requires tmux 2.1. a lot of these settings will error on anything earlier.
# Act like Vim; use h,j,k,l to select panes and move the cursor
set-window-option -g mode-keys vi
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
# Look good
set-option -g default-terminal "screen-256color"
# connect to user namespace
# (http://www.economyofeffort.com/2013/07/29/reattach-to-user-namespace-the-fix-for-your-tmux-in-os-x-woes/)
set-option -g default-command "reattach-to-user-namespace -l bash"
# Enable mouse support (works in iTerm)
set-option -g -q mouse on
# make mousewheel work when not in copy mode
bind-key -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M"
bind-key -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M"
bind-key -t vi-copy WheelUpPane halfpage-up
bind-key -t vi-copy WheelDownPane halfpage-down
# scrollback buffer size increase (this eats up memory, sometimes)
set -g history-limit 500000
# C-b C-b will swap to last used window
bind-key C-b last-window
# Start tab numbering at 1
set -g base-index 1
set-window-option -g pane-base-index 1
# Allows for faster key repetition
set -s escape-time 0
# Highlight active window in tab-bar at bottom in red
set-window-option -g window-status-current-bg red
# use different keys to split vertical and horizonal
# ^B | for vertical split
# ^B - for horizontal split
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# Change cursor in vim to distinguish between insert and command mode
# Use in conjunction with tmux-cursors.vim
set-option -g terminal-overrides '*88col*:colors=88,*256col*:colors=256,xterm*:XT:Ms=\E]52;%p1%s;%p2%s\007:Cc=\E]12;%p1%s\007:Cr=\E]112\007:Cs=\E]50;CursorShape=%?%p1%{3}%<%t%{0}%e%p1%{2}%-%;%d\007'
# use C-b v to paste the tmux buffer
bind v paste-buffer
# clipboard stuff for OSX
# be sure to `brew install reattach-to-user-namespace` to use this
# ^B ^C to set system clipboard to tmux's
bind C-c run "tmux save-buffer - | reattach-to-user-namespace pbcopy"
bind C-v run "tmux set-buffer $(reattach-to-user-namespace pbpaste); tmux paste-buffer"
bind p paste-buffer
bind -t vi-copy 'v' begin-selection
bind -t vi-copy 'y' copy-selection
# show battery status in status bar. comment this out if you don't need it
# gem install batt
set-option -g status-right-length 120
set-option -g status-right "[ #(batt meter --tmux --size 10) #(batt capacity) ] #(date \"+%Y-%m-%d %H:%M\")"
# renumber windows (if you have gaps in numbering, this renumbers them sequentially
# ^B r
bind r movew -r
# split the screen into a main screen and an 80-width pane on the right
bind -n C-g split-window -h -c "#{pane_current_path}" \; resize-pane -x 80 \; select-pane -t 0
# split the screen into main screen with 16-tall pane on the bottom
bind g split-window -v -c "#{pane_current_path}"\; resize-pane -y 16 \; select-pane -t 0
# move current window left and right in the tab list, respectively.
bind '<' swap-window -t -1
bind '>' swap-window -t +1
# ^B \ : resize the currently selected pane to be 80 columns
bind '\' resize-pane -x 80
# ^B ] : resize the currently selected pane to 16 rows high
bind ']' resize-pane -y 16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment