tmux Configuration

This is a dump of all tmux related configuration and scripts so I can edit them in one place and tangle from a single file.

tmux configuration

Start windows and panes at 1, not 0,

set -g base-index 1
set -g pane-base-index 1

Replace C-b with \,

unbind C-b 
set -g prefix '\'
bind-key '\' send-prefix
set-window-option -g xterm-keys on

Setup key bindings,

bind-key r command-prompt -p "rename window to:"  "rename-window '%%'"
bind t source-file ~/.tmux-over-ssh.conf
bind k confirm kill-window
bind K confirm kill-server

bind tab last-window

# window movement / renumbering like in screen's :number
bind-key m command-prompt -p "move window to:"  "swap-window -t '%%'"

Enable UTF-8,

setw -g utf8 on
set -g status-utf8 on
setw -g window-status-current-format "|#I:#W|"

Makes using the scroll wheel automatically switch to copy mode and scroll back the tmux scrollback buffer.

set -g mouse on

Status bar,

set-option -g status-interval 60
set-option -g status-right-length 120
set -g status-right '#(date +"%a %b %_d %H:%M") | #(hostname)'

Create a new window, swtich to home directory and type tmux-ssh,

neww -n tmux-ssh
send-keys -t tmux-ssh "cd ~/" C-m
send-keys -t tmux-ssh "tmux-ssh "

Create/attach a dev session. Start tmux create two windows for two emacs instances for for editing one for dired.

TERM=xterm-256color
tmux has-session -t dev 
if [ $? != 0 ]
then
    tmux new-session -s dev -n emacs -d
    tmux send-keys -t dev 'cd ~/' C-m 
    tmux send-keys -t dev 'emacs -main-instance' C-m
    tmux new-window -n dired -t dev
    tmux send-keys -t dev 'cd ~/' C-m 
    tmux send-keys -t dev 'emacs' C-m
fi
tmux attach -t dev

Solarized theme,

# default statusbar colors
set-option -g status-bg colour235 #base02
set-option -g status-fg colour136 #yellow
set-option -g status-attr default

# default window title colors
set-window-option -g window-status-fg colour244 #base0
set-window-option -g window-status-bg default
#set-window-option -g window-status-attr dim

# active window title colors
set-window-option -g window-status-current-fg colour166 #orange
set-window-option -g window-status-current-bg default
#set-window-option -g window-status-current-attr bright

# pane border
set-option -g pane-border-fg colour235 #base02
set-option -g pane-active-border-fg colour240 #base01

# message text
set-option -g message-bg colour235 #base02
set-option -g message-fg colour166 #orange

# pane number display
set-option -g display-panes-active-colour colour33 #blue
set-option -g display-panes-colour colour166 #orange

# clock
set-window-option -g clock-mode-colour colour64 #green