tmux: add ctrl-shift movement fragment file

This commit is contained in:
psox 2022-09-29 16:41:46 +01:00
parent fdba97e517
commit cf932c2051
1 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,33 @@
# This fragmenet is meant to be used with a Vim plugin and provides unified movement
# between Vim window/panes and tmux panes. It requires you install the following in
# Vim to function correctly:
#
# github.com/christoomey/vim-tmux-navigator
#
# Include it by adding the following snippet to your early (or late) tmux.conf:
#
# source-file "$PSOXIZSH/tmux/fragment/ctrl-shift-movement.conf"
### --- This uses Ctrl-Shift-<arrow> movement --- ###
# Integration with vim-tmux-navigator & fzf
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
is_fzf="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?fzf$'"
bind -n C-S-Left run "($is_vim && tmux send-keys C-S-Left) \
|| tmux select-pane -L"
bind -n C-S-Down run "($is_vim && tmux send-keys C-S-Down) \
|| ($is_fzf && tmux send-keys C-S-Down) \
|| tmux select-pane -D"
bind -n C-S-Up run "($is_vim && tmux send-keys C-S-Up) \
|| ($is_fzf && tmux send-keys C-S-Up) \
|| tmux select-pane -U"
bind -n C-S-Right run "($is_vim && tmux send-keys C-S-Right) \
|| tmux select-pane -R"
bind-key -T copy-mode-vi 'C-S-Left' select-pane -L
bind-key -T copy-mode-vi 'C-S-Down' select-pane -D
bind-key -T copy-mode-vi 'C-S-Up' select-pane -U
bind-key -T copy-mode-vi 'C-S-Right' select-pane -R