Typo checking number of colours.
[profile.git] / .tmux.conf
index 4e5fda4..3345bd0 100644 (file)
@@ -9,19 +9,28 @@ set -g status-keys vi
 # Don't wait so long to parse escape sequences.
 set -s escape-time 100
 
-# Ensure KRB5CCNAME is preserved in the environment.
-set -g update-environment 'DISPLAY WINDOWID SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION KRB5CCNAME'
-
 # Clock.
 setw -g clock-mode-colour white
 setw -g clock-mode-style 24
 
+# Scrollback buffer.
+set -g history-limit 4096
+
+# Don't use the mouse to select text by default.
+# It has two important flaws.  Double-clicking to select a word doesn't work.
+# Middle clicking to paste doesn't work.
+set -g mouse-resize-pane off
+set -g mouse-select-pane off
+set -g mouse-select-window off
+set -g mode-mouse off
+
 ################################################################################
 # Screen compatibility.
 ################################################################################
 set -g prefix C-p
 unbind C-b
 bind C-p last-window
+bind p send-keys C-p
 bind C-l refresh-client
 bind l refresh-client
 bind S split-window -v
@@ -42,25 +51,35 @@ bind j select-pane -D
 bind C-j select-pane -D
 bind k select-pane -U
 bind C-k select-pane -U
-# Previous and next window kinda like Vim.
-bind h previous-window
-bind C-h previous-window
-bind l next-window
-bind C-l next-window
-# And for panes.
-bind H select-pane -L
-bind L select-pane -R
+# Previous and next panes kinda like Vim.
+bind h select-pane -L
+bind C-h select-pane -L
+bind l select-pane -R
+bind C-l select-pane -R
+# And for windows.
+bind H previous-window
+bind L next-window
+# Last window like Vim.
+bind ^ last-window
+bind C-^ last-pane
 # Top and bottom.
-bind J select-pane -t bottom
-bind K select-pane -t top
+bind J select-pane -D
+bind K select-pane -U
 # Swap panes.
-bind w swap-pane
+bind o swap-pane -D
+bind C-o swap-pane -D
+bind O swap-pane -U
+bind w command-prompt -p "Select [<window>.]<pane> to swap:" 'swap-pane -s . -t %1'
+# Swap windows.
+bind W choose-window "swap-window -t '%%'"
 # Show panes.
 bind = display-panes
 # Move the current pane into a separate window.
 bind b break-pane
 # Split another pane into this window.
-bind B command-prompt -p "Select [<window>.]<pane> to join:" 'join-pane -t %1'
+bind B command-prompt -p "Select <window>[.<pane>] to join:" 'join-pane -s %1'
+# Split vertically.
+bind C-\ split-window -v
 # Next pane.
 bind i select-pane -t :.+
 bind C-i select-pane -t :.+
@@ -70,8 +89,18 @@ bind . select-layout even-vertical
 bind , select-layout tiled
 # Simulate maximising the window.
 bind / select-layout even-vertical \; swap-pane -s top \; resize-pane -D 9999
-# Show windows
-bind - list-windows
+# Select windows.
+bind - choose-window
+bind M-0 select-window -t 10
+bind M-1 select-window -t 11
+bind M-2 select-window -t 12
+bind M-3 select-window -t 13
+bind M-4 select-window -t 14
+bind M-5 select-window -t 15
+bind M-6 select-window -t 16
+bind M-7 select-window -t 17
+bind M-8 select-window -t 18
+bind M-9 select-window -t 19
 # Set current window title.
 bind t command-prompt -p "Set window's title to:" 'rename-window %1'
 # Show clock.
@@ -90,6 +119,8 @@ bind { copy-mode -u
 #bind '"' choose-buffer 'show-buffer -b %%'
 bind '"' list-buffers \; command-prompt -p "Choose buffer to show:" 'show-buffer -b %1'
 bind "'" show-buffer
+# Toggle mouse mode as it is useful despite the flaws listed above.
+bind C-m set -g mouse-resize-pane \; set -g mouse-select-pane \; set -g mouse-select-window \; set -g mode-mouse
 
 ################################################################################
 # Fix missing binds in Vi modes.
@@ -110,7 +141,7 @@ bind -t vi-copy y copy-selection
 ################################################################################
 set -g default-terminal 'screen-256color'
 # PuTTY needs help to set bold colours.
-set -g terminal-overrides 'putty-256color:C8'
+set -a -g terminal-overrides ',putty-256color:C8:Ms=\\E]52;%p1%s;%p2%s\\007m'
 
 ################################################################################
 # Window and pane settings.
@@ -149,7 +180,7 @@ setw -g window-status-current-bg colour17
 setw -g window-status-current-fg white
 # No border.
 set -g status-left ''
-set -g status-right ''
+set -g status-right '#[fg=white,bg=colour8][#H:#S]'
 # Window flags.
 setw -g window-status-current-format '[#I.#P#F #W]'
 setw -g window-status-format ' #I.#P#F #W '