Skip to content

Instantly share code, notes, and snippets.

@dphase
Created April 4, 2014 01:05
Show Gist options
  • Save dphase/9966041 to your computer and use it in GitHub Desktop.
Save dphase/9966041 to your computer and use it in GitHub Desktop.
# ╔═════════════════════════════════════╦═══════════════════════════════╗
# ║ _ ____ _ ║ _ ║─┐
# ║ __| | _ \| |__ __ _ ___ ___ ║ | |_ _ __ ___ _ ___ __ ║ │
# ║ / _` | |_) | '_ \ / _` / __|/ _ \ ║ | __| '_ ` _ \| | | \ \/ / ║ │
# ║ | (_| | __/| | | | (_| \__ \ __/ ║ | |_| | | | | | |_| |> < ║ │
# ║ \__,_|_| |_| |_|\__,_|___/\___| ║ \__|_| |_| |_|\__,_/_/\_\ ║ │
# ║ ║ ║ │
# ╚═════════════════════════════════════╩═══════════════════════════════╝ │
# └──────────────────────────────────────────────────────────────────────┘
# tap the os x clipboard
set-option -g default-command "reattach-to-user-namespace -l zsh"
# basic global settings:
set-option -g status-keys vi
set-window-option -g mode-keys vi
set-window-option -g utf8 on
set-window-option -g mode-mouse on
set-option -g mouse-select-pane on
set-option -g mouse-resize-pane on
set-option -g mouse-select-window on
set -g default-terminal screen-256color
set-option -g history-limit 10000
set -s escape-time 0
setw -g aggressive-resize on
##
## keybinds - mimic GNU screen
##
# Unbind existing tmux key bindings (except 0-9).
# Set the prefix to ^A.
# unbind C-b
# set -g prefix ^A
# bind a send-prefix
# Bind appropriate commands similar to screen.
# lockscreen ^X
unbind ^X
bind ^X lock-server
# screen ^C c
unbind ^C
bind ^C new-window
unbind c
bind c new-window
# detach ^D d
unbind ^D
bind ^D detach
# displays *
unbind *
bind * list-clients
# next ^@ ^N sp n
unbind ^@
bind ^@ next-window
unbind ^N
bind ^N next-window
unbind " "
bind " " next-window
unbind n
bind n next-window
# title A
unbind A
bind A command-prompt "rename-window %%"
# other ^A
unbind ^A
bind ^A last-window
# prev ^H ^P p ^?
unbind ^H
bind ^H previous-window
unbind ^P
bind ^P previous-window
unbind p
bind p previous-window
unbind BSpace
bind BSpace previous-window
# windows ^W
unbind ^W
bind ^W list-windows
# quit \
# unbind \
# bind \ confirm-before "kill-server"
# kill K k
unbind K
bind K confirm-before "kill-window"
unbind k
bind k confirm-before "kill-window"
# redisplay ^L l
unbind ^L
bind ^L refresh-client
#unbind l
#bind l refresh-client
# logging
bind L pipe-pane -o 'cat >>$HOME/#W-tmux.log' \; display-message 'Started logging to $HOME/#W-tmux.log'
bind l pipe-pane \; display-message 'Ended logging to $HOME/#W-tmux.log'
# More straight forward key bindings for splitting
unbind %
bind | split-window -h
bind \ split-window -h
bind v split-window -h
unbind '"'
bind - split-window -v
bind h split-window -v
# Pane
unbind s
bind s select-pane -D
unbind w
bind w select-pane -U
unbind z
bind z select-pane -L
unbind x
bind x select-pane -R
# break pane into own window
bind-key B break-pane
# pane movement
bind-key j command-prompt -p "join pane from:" "join-pane -s '%%'"
bind-key J command-prompt -p "send pane to:" "join-pane -t '%%'"
unbind ^k
bind-key ^k resize-pane -U
unbind ^j
bind-key ^j resize-pane
unbind ^l
bind-key ^l resize-pane -R
unbind ^h
bind-key ^h resize-pane -L
# swapping
bind-key W swap-pane -U
bind-key S swap-pane -D
# more pane movement, i bind these to cmd-[arrow] in iterm
bind-key Q select-pane -L
bind-key E select-pane -D
bind-key R select-pane -U
bind-key T select-pane -R
# sync panes
unbind ^s
bind-key ^s set-window-option synchronize-panes on \; display-message "Sync panes ON"
unbind ^S
bind-key ^S set-window-option synchronize-panes off \; display-message "Sync panes OFF"
# reload config
bind-key r source-file ~/.tmux.conf \; display-message "Configuration reloaded"
###
### Apperance
###
## window titles
# enable wm (e.g. fluxbox) window titles:
set-option -g set-titles on
# example: [localhost:session(window-title)] bryce@remotehost
# bryce@remotehost is set from bash prompt export in .bashrc
#set-option -g set-titles-string "tmux #S@#h(#T #W)"
#set-option -g set-titles-string "[#h:#S(#W)] #T"
set-option -g set-titles-string "tmux | #T (#I/#P)"
## cheats for customizing above
# H Host
# I Current window index
# P Current pane index
# S Session name
# T Current window title
# W Current window name
# # A literal #
## panes:
# active pane
set-option -g pane-active-border-fg colour240
set-option -g pane-active-border-bg default
# inactive pane
set-option -g pane-border-fg colour240
set-option -g pane-border-bg default
# clock-mode
set-window-option -g clock-mode-colour red
set-window-option -g clock-mode-style 12
# command/message line colors
set-option -g message-bg colour208
set-option -g message-fg black
# messages (tmux system messages)
set-window-option -g mode-bg yellow
set-window-option -g mode-fg black
# default statusbar colors
set-option -g status-fg white
set-option -g status-bg colour235
# other statusbar configs:
set-option -g status-interval 5
set-option -g status-utf8 on
set-option -g status-justify right
# active window title colors
set-window-option -g window-status-current-fg yellow
set-window-option -g window-status-current-bg colour235
set-window-option -g window-status-attr bright
# inactive window title colors
set-window-option -g window-status-fg white
set-window-option -g window-status-bg colour235
set-window-option -g window-status-attr dim
# window title:
set-option -g set-titles on
# set-option -g set-titles-string 'jd'
setw -g automatic-rename on
# default is "on" for status bar
set-option -g status on
# center align window list
set-option -g status-justify left
# what is to be shown to the left on the status bar
# ░ ▒ ▓ █
set-option -g status-left-length 35
set-option -g status-left '#[fg=colour220,bg=colour220] #[fg=colour220,bg=colour166]▓▒░ #[fg=colour255]#(hostname | cut -d . -f 1) #[fg=colour160]░▒▓#[bg=colour160] #[fg=colour160,bg=colour235]▓▒░#[default]'
# what is to be shown to the right on the status bar
set-option -g status-right-length 60
#set-option -g status-right '#[fg=blue,bg=black] Load: #(uptime | cut -f 13,14,15 -d " ") %a %d-%b-%y %I:%M%p '
set-option -g status-right '#[fg=colour237,bg=colour235]⮂#[fg=colour255,bg=colour237] %a %m/%d/%y #[fg=colour241]⮂#[fg=colour255,bg=colour241] %I:%M%p '
# lock entire session, and all clients (seconds)
# set-option -g lock-server on
# set-option -g lock-after-time 3600
# set-option -g lock-command 'cmatrix -b -u 9'
# copy mode crap
unbind [
bind-key Escape copy-mode
unbind [
bind-key P paste-buffer
bind -t vi-copy v begin-selection
bind -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
# sync panes for output
# unbind y
# bind-key y set-window-option synchronize-panes on \; display-message "Sync panes ON"
# unbind Y
# bind-key Y set-window-option synchronize-panes off \; display-message "Sync panes OFF"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment