From: Iain Patterson Date: Mon, 5 Sep 2011 15:11:00 +0000 (+0100) Subject: Defeat various key repeating niggles. X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=35a3cbb0c868c98f17cd0352e96414c3347760be;p=profile.git Defeat various key repeating niggles. Don't allow key repeating for unshifted keys and arrows. Switch to pane left with ^p l. Start typing ls. Find yourself two panes left. But allow control-alt-h/j/k/l to resize windows with repeats. Using alt on its own doesn't work because terminal funkiness will lead tmux to think, for example, alt-k was pressed if ^p^k is quickly followed by escape then ^k. This can (and does) happen when switching to a pane and immediately recalling the previous history entry. --- diff --git a/.tmux.conf b/.tmux.conf index 9b915df..dcd460b 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -46,17 +46,22 @@ 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 +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 C-h select-pane -L +bind -r C-h select-pane -L bind l select-pane -R -bind C-l select-pane -R +bind -r C-l select-pane -R # And for windows. -bind H previous-window -bind L next-window +bind -r H previous-window +bind -r L next-window # Last window like Vim. bind ^ last-window bind C-^ last-pane @@ -65,8 +70,8 @@ bind J select-pane -D bind K select-pane -U # Swap panes. bind o swap-pane -D -bind C-o swap-pane -D -bind O swap-pane -U +bind -r C-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 '%%'" @@ -80,11 +85,17 @@ bind B command-prompt -p "Select [.] to join:" 'join-pane -s %1' 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 -r Space next-layout # Simulate maximising the window. bind / select-layout even-vertical \; swap-pane -s top \; resize-pane -D 9999 # Select windows. @@ -116,7 +127,7 @@ 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. bind C-m set -g mouse-resize-pane \; set -g mouse-select-pane \; set -g mouse-select-window \; set -g mode-mouse