29 lines
1.4 KiB
Text
29 lines
1.4 KiB
Text
# helper to decide whether we are inside (n)vim
|
|
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
|
|
| grep -iqE '^[^TXZ ]+ +(\\$+\\/)?g?(view|n?vim?x?)(diff)?$'"
|
|
|
|
# Correct binding depending on version
|
|
if-shell -b '[[ "$(tmux -V)" == tmux\ 2.* ]]' \
|
|
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
|
|
if-shell -b '[[ "$(tmux -V)" == tmux\ 3.* ]]' \
|
|
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
|
|
|
|
# Bindings
|
|
bind-key -n 'C-Space' if-shell "$is_vim" 'send-keys C-Space' 'select-pane -t:.+'
|
|
|
|
bind-key -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'select-pane -L'
|
|
bind-key -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'select-pane -D'
|
|
bind-key -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'select-pane -U'
|
|
bind-key -n 'M-l' if-shell "$is_vim" 'send-keys M-l' 'select-pane -R'
|
|
|
|
bind-key -n 'M-Left' if-shell "$is_vim" 'send-keys M-h' 'select-pane -L'
|
|
bind-key -n 'M-Down' if-shell "$is_vim" 'send-keys M-j' 'select-pane -D'
|
|
bind-key -n 'M-Up' if-shell "$is_vim" 'send-keys M-k' 'select-pane -U'
|
|
bind-key -n 'M-Right' if-shell "$is_vim" 'send-keys M-l' 'select-pane -R'
|
|
|
|
bind-key -T copy-mode-vi 'M-h' select-pane -L
|
|
bind-key -T copy-mode-vi 'M-j' select-pane -D
|
|
bind-key -T copy-mode-vi 'M-k' select-pane -U
|
|
bind-key -T copy-mode-vi 'M-l' select-pane -R
|
|
bind-key -T copy-mode-vi 'C-\' select-pane -l
|
|
bind-key -T copy-mode-vi 'C-Space' select-pane -t:.+
|