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