X-Git-Url: http://git.iain.cx/?p=profile.git;a=blobdiff_plain;f=.tmux.conf;h=9b7e9d0ca8ad2dd3c546fdc8007951b7a9c4f145;hp=8de9f0f0d581ca8a70a4ac9be6cdd7dce57303fb;hb=48f30af664cf57c765a763eea7c652da92d66c27;hpb=4fcf9cd7282d42387e839ccc329edce4dc32e78b diff --git a/.tmux.conf b/.tmux.conf index 8de9f0f..9b7e9d0 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1,6 +1,10 @@ ################################################################################ # Options. ################################################################################ +# Start in home. The documentation says ~ is supported but tmux 1.7 +# barfs on it. +set -g default-path "$HOME" + # Use vi keys for scrolling etc. # Use lsk -t vi|emacs- to see binds in table choice, copy or edit. setw -g mode-keys vi @@ -9,27 +13,35 @@ 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 C-l refresh-client -bind l refresh-client +bind p send-keys C-p bind S split-window -v bind | split-window -h bind C-[ copy-mode bind ] paste-buffer bind C-] paste-buffer bind _ setw monitor-activity +bind M-_ setw monitor-silence 10 bind * list-clients bind < command-prompt -p "Load buffer from file:" 'load-buffer %1' bind > command-prompt -p "Save buffer to file:" 'save-buffer %1' @@ -39,39 +51,77 @@ bind > command-prompt -p "Save buffer to file:" 'save-buffer %1' ################################################################################ # Up and down like Vim. bind j select-pane -D -bind C-j select-pane -D +bind -r 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 +bind -r C-k select-pane -U +# Don't let arrow keys repeat. +bind Up select-pane -U +bind Down select-pane -D +bind Left select-pane -L +bind Right select-pane -R +# Previous and next panes kinda like Vim. +bind h select-pane -L +bind -r C-h select-pane -L +bind l select-pane -R +bind -r C-l select-pane -R +# And for windows. +bind -r H previous-window +bind -r L next-window +# Last window like Vim. +bind ^ last-window +bind C-^ last-pane +bind C-o 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 -r O swap-pane -U +bind w command-prompt -p "Select [.] to swap:" 'swap-pane -s . -t %1' +# Swap windows. +bind W choose-window "swap-window -t '%%'" +# Renumber windows. +bind M-w move-window -r -s : -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 [.] to join:" 'join-pane -t %1' +bind B command-prompt -p "Select [.] 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 :.+ -bind I select-pane -t :.- +bind -r C-i select-pane -t :.+ +bind -r I select-pane -t :.- +# Resize pane. +bind -r C-M-h resize-pane -L +bind -r C-M-j resize-pane -D +bind -r C-M-k resize-pane -U +bind -r C-M-l resize-pane -R # Layouts. -bind . select-layout even-vertical -bind , select-layout tiled +bind , select-layout even-vertical +bind . select-layout even-horizontal +bind / select-layout tiled +bind M-, select-layout main-vertical +bind M-. select-layout main-horizontal +bind Space next-layout +bind -r C-Space next-layout # Simulate maximising the window. -bind / select-layout even-vertical \; swap-pane -s top \; resize-pane -D 9999 -# Show windows -bind - list-windows +bind / select-layout main-horizontal \; resize-pane -D 9999 +bind M-/ select-layout tiled +# 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. @@ -89,7 +139,12 @@ bind { copy-mode -u # XXX: As of tmux 1.3 this doesn't work. #bind '"' choose-buffer 'show-buffer -b %%' bind '"' list-buffers \; command-prompt -p "Choose buffer to show:" 'show-buffer -b %1' -bind "'" show-buffer +bind "'" new-window -n "[buffer]" "cat > /dev/null" \; paste-buffer +# Toggle mouse mode as it is useful despite the flaws listed above. +# As of tmux 1.7 mode-mouse has three possible values so we can no +# longer use an implied toggle. +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 +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 ################################################################################ # Fix missing binds in Vi modes. @@ -110,7 +165,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. @@ -121,9 +176,11 @@ set -g display-panes-colour colour17 # Command entry. set -g message-bg colour90 set -g message-fg white +set -g message-command-bg colour88 +set -g message-command-fg white # Active pane set -g pane-active-border-bg default -set -g pane-active-border-fg white +set -g pane-active-border-fg colour31 # Inactive pane. set -g pane-border-bg default set -g pane-border-fg colour17 @@ -133,12 +190,23 @@ setw -g mode-fg white # Monitored windows (in reverse video). setw -g window-status-alert-bg red setw -g window-status-alert-fg white +# As of tmux 1.6 we can highlight different alerts. +setw -g window-status-bell-bg colour22 +setw -g window-status-bell-fg white +setw -g window-status-content-bg colour88 +setw -g window-status-content-fg white +setw -g window-status-content-attr none +setw -g window-status-activity-bg red +setw -g window-status-activity-fg white ################################################################################ # Caption settings. ################################################################################ # Don't update the title bar. set -g set-titles off +set -g allow-rename off +# Allow pane renames if no name was explicitly set. +set -g automatic-rename on # Status line black on white. set -g status-attr none set -g status-bg white @@ -153,5 +221,3 @@ 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 ' -# Don't set window name. XXX: Issue with PROMPT_COMMAND. -#setw -g automatic-rename off