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