Skip to content

Instantly share code, notes, and snippets.

@d-mart
Created August 20, 2013 13:05
Show Gist options
  • Save d-mart/6281098 to your computer and use it in GitHub Desktop.
Save d-mart/6281098 to your computer and use it in GitHub Desktop.
Tmux conf that works on older tmuxen (1.1 ~ 1.6)
###############
## Tmux Settings
###############
## To start a second 'view' of a session in another shell
# tmux new-session -t <session_name>
## Later, kill that second session (see 'tmux ls') linked to the first
# tmux kill-session -t 2
## set Ctrl-a to prefix instead of Ctrl-b
## (just like screen)
set -g prefix C-a
unbind C-b
unbind `
# bind C-a send-prefix
# OR - can't unlearn this form screen days
bind C-a last-window # C-a C-a bounces between last two windows
bind a send-prefix # C-a a send a literal C-a to terminal
# Testing a different prefix key
#set -g prefix2 `
#bind ` send-prefix2
## set Ctrl-a to prefix instead of Ctrl-b
## (just like screen)
#unbind C-b
#set -g prefix `
#bind ` send-prefix
#set -g prefix2 C-a
#
## bind C-a send-prefix
## OR - can't unlearn this form screen days
#bind C-a last-window # C-a C-a bounces between last two windows
#bind a send-prefix # C-a a send a literal C-a to terminal
# start at 1 instead of 0 (easier to reach)
set -g base-index 1
# start panes at 1 too
#setw -g pane-base-index 1
# short delay when pressing escape
#set -sg escape-time 1
# turn off mouse
setw -g mode-mouse off
# set terminal for xterm-256color - this is the best mix of compatible and 256-y, ime.
set -g default-terminal "xterm-256color"
# allow 'pbpaste' and 'pbcopy' commands to work in tmux. OSX only
set-option -g default-command "[ -f ~/bin/reattach-to-user-namespace ] && ~/bin/reattach-to-user-namespace -l bash || bash"
# keep lots of scrollback
set -g history-limit 100000
# as soon as small clients stop looking at a window,
# make it as large as the big client can accomodate
setw -g aggressive-resize on
###############
## Look and Feel
###############
# pane borders
#set -g pane-border-fg white
#set -g pane-border-bg black
#set -g pane-active-border-fg green
#set -g pane-active-border-bg black
# messages
set -g message-fg black
set -g message-bg white
set -g message-attr bright
# status bar defaults
setw -g window-status-fg cyan
setw -g window-status-bg default
setw -g window-status-attr dim
setw -g window-status-current-attr reverse
#setw -g window-status-activity-attr bold
#set-window-option -g window-status-current-format '#[bg=none,fg=cyan]#I:#W#F'
# Status bar contents
set -g status-bg colour233
set -g status-fg white
set -g status-left "#[fg=green]#S#[fg=white]:#[fg=yellow]#I#[fg=white]:#[fg=cyan]#P #[fg=white] "
set -g status-left-length 32
set -g status-right "#[fg=cyan]#h #[fg=yellow]%e %b %Y #[fg=green]%H:%M:%S"
set -g status-interval 1
set -g status-justify centre
# watch for changes in other windows
setw -g monitor-activity on
#set -g visual-activity on
###############
## Keybindings
###############
# r reloads tmux.conf
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# clear scroll-back buffer
bind k clear-history
# select windows >10 with Shift-<n>
bind ')' select-window -t 10
bind '!' select-window -t 11
bind '@' select-window -t 12
bind '#' select-window -t 13
bind '$' select-window -t 14
bind '%' select-window -t 15
bind '^' select-window -t 16
bind '&' select-window -t 17
bind '*' select-window -t 18
bind '(' select-window -t 19
# extra commands for splitting
bind | split-window -h
bind - split-window -v
# Pane resizing
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
# Work with panes
bind j command-prompt -p "join pane from:" "join-pane -s '%%'"
bind s command-prompt -p "send pane to:" "join-pane -t '%%'"
bind b break-pane
bind E setw synchronize-panes
# Move windows around
bind M command-prompt -p "set window number:" "move-window -t '%%'"
bind S command-prompt -p "swap window:","with window:" "swap-window -s %1 -t %2"
# Cycle thru sessions (note: no prefix)
bind -n M-8 choose-session
#bind -n M-9 switch-client -p
#bind -n M-0 switch-client -n
# Shortcuts
bind R new-window -t 9 -n root 'sudo -i' # Get a root window
###############
## Externals
###############
##
## tmux-powerline
##
set-option -g status on
set-option -g status-interval 2
set-option -g status-utf8 on
set-option -g status-justify "centre"
set-option -g status-left-length 60
set-option -g status-right-length 90
#set-option -g status-left "#(~/proj/tmux-powerline/powerline.sh left)"
#set-option -g status-right "#(~/proj/rainbarf/rainbarf --battery --bolt --tmux --no-bright) #(~/proj/tmux-powerline/powerline.sh right)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment