Skip to content

Instantly share code, notes, and snippets.

@lukec
Created July 16, 2015 05:50
Show Gist options
  • Save lukec/02a6ee035ecc97294962 to your computer and use it in GitHub Desktop.
Save lukec/02a6ee035ecc97294962 to your computer and use it in GitHub Desktop.
Luke's I-just-discovered-tmux-and-made-it-like-screen-but-better
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
set -g status-keys vi
set -g history-limit 10000
setw -g monitor-activity off
# Different ways to resize the panes
bind-key J resize-pane -D 5
bind-key K resize-pane -U 5
bind-key H resize-pane -L 5
bind-key L resize-pane -R 5
bind-key M-j resize-pane -D
bind-key M-k resize-pane -U
bind-key M-h resize-pane -L
bind-key M-l resize-pane -R
# Vim style pane selection
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# No delay for escape key press
set -sg escape-time 0
# Ctrl-a r - Reload tmux config
bind r source-file ~/src/recollect/.tmuxrc
# Status bar
set -g status-bg green
set -g status-fg white
set -g window-status-current-bg cyan
set -g window-status-current-fg black
set -g window-status-current-attr bold
set -g status-interval 60
set -g status-left-length 30
set -g status-left '#[fg=blue](#S) #(whoami)'
set -g status-right '#[fg=black]#(cut -d " " -f 1-3 /proc/loadavg)#[default] #[fg=white]%H:%M#[default]'
###########################
# Below is largely copied from https://github.com/mostlygeek/env-personalize/blob/master/install.sh#L90-L151
# Change tmux's default of Ctrl-B to be like Screen's Ctrl-A
unbind C-b
set -g prefix C-a
bind-key C-a last-window
# Allow C-A a to send C-A to application like tmux/screen over ssh
bind a send-prefix
# set status bar color
set-option -g allow-rename off
# make it easier to split window
unbind %
bind | split-window -h
bind - split-window -v
# set default colors
set -g default-terminal "screen-256color"
# bind ctrl+k (no prefix required) to clear scrollback
bind -n C-k clear-history
# Set vi mode
# http://blog.sanctum.geek.nz/vi-mode-in-tmux/
set-window-option -g mode-keys vi
# Ref: http://jasonwryan.com/blog/2012/06/07/copy-and-paste-in-tmux/
# Make it more like vim to copy / paste text into the buffer, using
# Ctrl-A [ to enter copy mode, then: v (select), move cursor, y (yank)
# Ctrl-A ] to paste
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection
@lukec
Copy link
Author

lukec commented Jul 16, 2015

My switch is not a political statement about screen vs tmux. my hand was forced by a upgrade that introduced a gross terminal bug in vim-in-screen-in-docker. but i don't regret the change, tmux is cool. i've already got the unit tests pass/fail updating the status bar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment