feat(tmux): pane moves on ctrl+u/h/j/k (arrow layout, AZERTY/QWERTY invariant)
Replaces ctrl+h/j/k/l and the option+arrow bindings. Resize mirrors it with prefix. C-l is free again, so it clears the shell screen.
This commit is contained in:
@@ -119,27 +119,23 @@ bind C-a send-prefix # C-a C-a = literal C-a (shell h
|
||||
bind-key C-o command-prompt "new-session -s %1 -c ~"
|
||||
bind R source-file ~/.config/tmux/tmux.conf \; display-message "Config reloaded..."
|
||||
|
||||
# Resizing key bindings
|
||||
bind-key -r C-l resize-pane -R 5
|
||||
bind-key -r C-k resize-pane -U 5
|
||||
bind-key -r C-j resize-pane -D 5
|
||||
# Resizing key bindings (same arrow layout as the moves below, with prefix)
|
||||
bind-key -r C-u resize-pane -U 5
|
||||
bind-key -r C-h resize-pane -L 5
|
||||
bind-key -r C-j resize-pane -D 5
|
||||
bind-key -r C-k resize-pane -R 5
|
||||
bind-key -r C-n next-window \; set status on
|
||||
bind-key -r C-p previous-window \; set status on
|
||||
|
||||
# Moving accross pane (and vim)
|
||||
# Moving across panes (and vim), no prefix: ctrl + u/h/j/k laid out as arrows
|
||||
# (u up, h left, j down, k right). These keys sit at the same place on AZERTY
|
||||
# and QWERTY US, and need no option key. Each one still reaches vim when vim
|
||||
# runs in the pane. C-l is free, so it clears the shell screen again.
|
||||
# Shell cost: C-u (readline "clear the line") is taken.
|
||||
bind -n C-u if-shell "$is_vim" "send-keys C-u" "select-pane -U"
|
||||
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
|
||||
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
|
||||
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
|
||||
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
|
||||
#bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
|
||||
|
||||
# Same moves on option+arrow (iTerm2 sends them as M-arrow; "Left Option key"
|
||||
# must be Esc+ or the xterm preset). C-i/C-m were ruled out: they are Tab/Enter.
|
||||
bind -n M-Left if-shell "$is_vim" "send-keys M-Left" "select-pane -L"
|
||||
bind -n M-Down if-shell "$is_vim" "send-keys M-Down" "select-pane -D"
|
||||
bind -n M-Up if-shell "$is_vim" "send-keys M-Up" "select-pane -U"
|
||||
bind -n M-Right if-shell "$is_vim" "send-keys M-Right" "select-pane -R"
|
||||
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -R"
|
||||
|
||||
bind Escape copy-mode # bind vi-like 'normal' mode
|
||||
bind -Tcopy-mode-vi 'v' send -X begin-selection # bind vi-like visual mode
|
||||
|
||||
Reference in New Issue
Block a user