dcd460bfb988e40a85ace3462ea0c2ba7c1ecc2d
[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 tiled
98 bind -r Space next-layout
99 # Simulate maximising the window.
100 bind / select-layout even-vertical \; swap-pane -s top \; resize-pane -D 9999
101 # Select windows.
102 bind - choose-window
103 bind M-0 select-window -t 10
104 bind M-1 select-window -t 11
105 bind M-2 select-window -t 12
106 bind M-3 select-window -t 13
107 bind M-4 select-window -t 14
108 bind M-5 select-window -t 15
109 bind M-6 select-window -t 16
110 bind M-7 select-window -t 17
111 bind M-8 select-window -t 18
112 bind M-9 select-window -t 19
113 # Set current window title.
114 bind t command-prompt -p "Set window's title to:" 'rename-window %1'
115 # Show clock.
116 bind T clock-mode
117 # Monitor window for a particular string.
118 bind m command-prompt -p "Monitor:" 'setw monitor-content %1'
119 bind M setw monitor-content ""
120 # Synchronise input.
121 bind \; setw synchronize-panes
122 # Choose buffer to paste.
123 bind } choose-buffer 'paste-buffer -b %%'
124 # Enter copy-mode and scroll up.
125 bind { copy-mode -u
126 # Choose buffer to show.
127 # XXX: As of tmux 1.3 this doesn't work.
128 #bind '"' choose-buffer 'show-buffer -b %%'
129 bind '"' list-buffers \; command-prompt -p "Choose buffer to show:" 'show-buffer -b %1'
130 bind "'" new-window -n "[buffer]" "cat > /dev/null" \; paste-buffer
131 # Toggle mouse mode as it is useful despite the flaws listed above.
132 bind C-m set -g mouse-resize-pane \; set -g mouse-select-pane \; set -g mouse-select-window \; set -g mode-mouse
133
134 ################################################################################
135 # Fix missing binds in Vi modes.
136 ################################################################################
137 # Command prompt.
138 bind -t vi-edit C-u delete-line
139 # We can't delete a word so ^w can clear the whole line for now.
140 bind -t vi-edit C-w delete-line
141 bind -t vi-edit Up history-up
142 bind -t vi-edit Down history-down
143 bind -t vi-edit Left cursor-left
144 bind -t vi-edit Right cursor-right
145 # Copy mode.
146 bind -t vi-copy y copy-selection
147
148 ################################################################################
149 # Terminal settings.
150 ################################################################################
151 set -g default-terminal 'screen-256color'
152 # PuTTY needs help to set bold colours.
153 set -a -g terminal-overrides ',putty-256color:C8:Ms=\\E]52;%p1%s;%p2%s\\007m'
154
155 ################################################################################
156 # Window and pane settings.
157 ################################################################################
158 set -g display-panes-time 1000
159 set -g display-panes-active-colour white
160 set -g display-panes-colour colour17
161 # Command entry.
162 set -g message-bg colour90
163 set -g message-fg white
164 # Active pane
165 set -g pane-active-border-bg default
166 set -g pane-active-border-fg white
167 # Inactive pane.
168 set -g pane-border-bg default
169 set -g pane-border-fg colour17
170 # Messages.
171 setw -g mode-bg blue
172 setw -g mode-fg white
173 # Monitored windows (in reverse video).
174 setw -g window-status-alert-bg red
175 setw -g window-status-alert-fg white
176
177 ################################################################################
178 # Caption settings.
179 ################################################################################
180 # Don't update the title bar.
181 set -g set-titles off
182 # Status line black on white.
183 set -g status-attr none
184 set -g status-bg white
185 set -g status-fg black
186 # Current window white on blue.
187 setw -g window-status-current-attr none
188 setw -g window-status-current-bg colour17
189 setw -g window-status-current-fg white
190 # No border.
191 set -g status-left ''
192 set -g status-right '#[fg=white,bg=colour8][#H:#S]'
193 # Window flags.
194 setw -g window-status-current-format '[#I.#P#F #W]'
195 setw -g window-status-format ' #I.#P#F #W '
196 # Don't set window name.  XXX: Issue with PROMPT_COMMAND.
197 #setw -g automatic-rename off