Tidyup.
[profile.git] / .tmux.conf
1 ################################################################################
2 # Options.
3 ################################################################################
4 # Start in home.  The documentation says ~ is supported but tmux 1.7
5 # barfs on it.
6 set -g default-path "$HOME"
7
8 # Use vi keys for scrolling etc.
9 # Use lsk -t vi|emacs-<table> to see binds in table choice, copy or edit.
10 setw -g mode-keys vi
11 set -g status-keys vi
12
13 # Don't wait so long to parse escape sequences.
14 set -s escape-time 100
15
16 # Clock.
17 setw -g clock-mode-colour white
18 setw -g clock-mode-style 24
19
20 # Scrollback buffer.
21 set -g history-limit 4096
22
23 # Don't use the mouse to select text by default.
24 # It has two important flaws.  Double-clicking to select a word doesn't work.
25 # Middle clicking to paste doesn't work.
26 set -g mouse-resize-pane off
27 set -g mouse-select-pane off
28 set -g mouse-select-window off
29 set -g mode-mouse off
30
31 ################################################################################
32 # Screen compatibility.
33 ################################################################################
34 set -g prefix C-p
35 unbind C-b
36 bind C-p last-window
37 bind p send-keys C-p
38 bind S split-window -v
39 bind | split-window -h
40 bind C-[ copy-mode
41 bind ] paste-buffer
42 bind C-] paste-buffer
43 bind _ setw monitor-activity
44 bind M-_ setw monitor-silence 10
45 bind * list-clients
46 bind < command-prompt -p "Load buffer from file:" 'load-buffer %1'
47 bind > command-prompt -p "Save buffer to file:" 'save-buffer %1'
48
49 ################################################################################
50 # Hotkeys.
51 ################################################################################
52 # Up and down like Vim.
53 bind j select-pane -D
54 bind -r C-j select-pane -D
55 bind k select-pane -U
56 bind -r C-k select-pane -U
57 # Don't let arrow keys repeat.
58 bind Up select-pane -U
59 bind Down select-pane -D
60 bind Left select-pane -L
61 bind Right select-pane -R
62 # Previous and next panes kinda like Vim.
63 bind h select-pane -L
64 bind -r C-h select-pane -L
65 bind l select-pane -R
66 bind -r C-l select-pane -R
67 # And for windows.
68 bind -r H previous-window
69 bind -r L next-window
70 # Last window like Vim.
71 bind ^ last-window
72 bind C-^ last-pane
73 bind C-o last-pane
74 # Top and bottom.
75 bind J select-pane -D
76 bind K select-pane -U
77 # Swap panes.
78 bind o swap-pane -D
79 bind -r O swap-pane -U
80 bind w command-prompt -p "Select [<window>.]<pane> to swap:" 'swap-pane -s . -t %1'
81 # Swap windows.
82 bind W choose-window "swap-window -t '%%'"
83 # Renumber windows.
84 bind M-w move-window -r -s : -t :
85 # Show panes.
86 bind = display-panes
87 # Move the current pane into a separate window.
88 bind b break-pane
89 # Split another pane into this window.
90 bind B command-prompt -p "Select <window>[.<pane>] to join:" 'join-pane -s %1'
91 # Split vertically.
92 bind C-\ split-window -v
93 # Next pane.
94 bind i select-pane -t :.+
95 bind -r C-i select-pane -t :.+
96 bind -r I select-pane -t :.-
97 # Resize pane.
98 bind -r C-M-h resize-pane -L
99 bind -r C-M-j resize-pane -D
100 bind -r C-M-k resize-pane -U
101 bind -r C-M-l resize-pane -R
102 # Layouts.
103 bind , select-layout even-vertical
104 bind . select-layout even-horizontal
105 bind / select-layout tiled
106 bind M-, select-layout main-vertical
107 bind M-. select-layout main-horizontal
108 bind Space next-layout
109 bind -r C-Space next-layout
110 # Simulate maximising the window.
111 bind / select-layout main-horizontal \; resize-pane -D 9999
112 bind M-/ select-layout tiled
113 # Select windows.
114 bind - choose-window
115 bind M-0 select-window -t 10
116 bind M-1 select-window -t 11
117 bind M-2 select-window -t 12
118 bind M-3 select-window -t 13
119 bind M-4 select-window -t 14
120 bind M-5 select-window -t 15
121 bind M-6 select-window -t 16
122 bind M-7 select-window -t 17
123 bind M-8 select-window -t 18
124 bind M-9 select-window -t 19
125 # Set current window title.
126 bind t command-prompt -p "Set window's title to:" 'rename-window %1'
127 # Show clock.
128 bind T clock-mode
129 # Monitor window for a particular string.
130 bind m command-prompt -p "Monitor:" 'setw monitor-content %1'
131 bind M setw monitor-content ""
132 # Synchronise input.
133 bind \; setw synchronize-panes
134 # Choose buffer to paste.
135 bind } choose-buffer 'paste-buffer -b %%'
136 # Enter copy-mode and scroll up.
137 bind { copy-mode -u
138 # Choose buffer to show.
139 # XXX: As of tmux 1.3 this doesn't work.
140 #bind '"' choose-buffer 'show-buffer -b %%'
141 bind '"' list-buffers \; command-prompt -p "Choose buffer to show:" 'show-buffer -b %1'
142 bind "'" new-window -n "[buffer]" "cat > /dev/null" \; paste-buffer
143 # Toggle mouse mode as it is useful despite the flaws listed above.
144 # As of tmux 1.7 mode-mouse has three possible values so we can no
145 # longer use an implied toggle.
146 bind C-m set -g mouse-resize-pane on \; set -g mouse-select-pane on \; set -g mouse-select-window on \; set -g mode-mouse copy-mode
147 bind M-m set -g mouse-resize-pane off \; set -g mouse-select-pane off \; set -g mouse-select-window off \; set -g mode-mouse off
148
149 ################################################################################
150 # Fix missing binds in Vi modes.
151 ################################################################################
152 # Command prompt.
153 bind -t vi-edit C-u delete-line
154 # We can't delete a word so ^w can clear the whole line for now.
155 bind -t vi-edit C-w delete-line
156 bind -t vi-edit Up history-up
157 bind -t vi-edit Down history-down
158 bind -t vi-edit Left cursor-left
159 bind -t vi-edit Right cursor-right
160 # Copy mode.
161 bind -t vi-copy y copy-selection
162
163 ################################################################################
164 # Terminal settings.
165 ################################################################################
166 set -g default-terminal 'screen-256color'
167 # PuTTY needs help to set bold colours.
168 set -a -g terminal-overrides ',putty-256color:C8:Ms=\\E]52;%p1%s;%p2%s\\007m'
169
170 ################################################################################
171 # Window and pane settings.
172 ################################################################################
173 set -g display-panes-time 1000
174 set -g display-panes-active-colour white
175 set -g display-panes-colour colour17
176 # Command entry.
177 set -g message-bg colour90
178 set -g message-fg white
179 set -g message-command-bg colour88
180 set -g message-command-fg white
181 # Active pane
182 set -g pane-active-border-bg default
183 set -g pane-active-border-fg colour31
184 # Inactive pane.
185 set -g pane-border-bg default
186 set -g pane-border-fg colour17
187 # Messages.
188 setw -g mode-bg blue
189 setw -g mode-fg white
190 # Monitored windows (in reverse video).
191 setw -g window-status-alert-bg red
192 setw -g window-status-alert-fg white
193 # As of tmux 1.6 we can highlight different alerts.
194 setw -g window-status-bell-bg colour22
195 setw -g window-status-bell-fg white
196 setw -g window-status-content-bg colour88
197 setw -g window-status-content-fg white
198 setw -g window-status-content-attr none
199 setw -g window-status-activity-bg red
200 setw -g window-status-activity-fg white
201
202 ################################################################################
203 # Caption settings.
204 ################################################################################
205 # Don't update the title bar.
206 set -g set-titles off
207 # Status line black on white.
208 set -g status-attr none
209 set -g status-bg white
210 set -g status-fg black
211 # Current window white on blue.
212 setw -g window-status-current-attr none
213 setw -g window-status-current-bg colour17
214 setw -g window-status-current-fg white
215 # No border.
216 set -g status-left ''
217 set -g status-right '#[fg=white,bg=colour8][#H:#S]'
218 # Window flags.
219 setw -g window-status-current-format '[#I.#P#F #W]'
220 setw -g window-status-format ' #I.#P#F #W '
221 # Don't set window name.  XXX: Issue with PROMPT_COMMAND.
222 #setw -g automatic-rename off