35 lines
1.4 KiB
Plaintext
35 lines
1.4 KiB
Plaintext
# 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/vim-movement.conf"
|
|
|
|
# Checks for if we're inside a Vim/FZF window
|
|
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$'"
|
|
|
|
# Binds Ctrl-<h,j,k,l> to left,down,up,right movements
|
|
bind -n C-h run "($is_vim && tmux send-keys C-h) \
|
|
|| tmux select-pane -L"
|
|
bind -n C-j run "($is_vim && tmux send-keys C-j) \
|
|
|| ($is_fzf && tmux send-keys C-j) \
|
|
|| tmux select-pane -D"
|
|
bind -n C-k run "($is_vim && tmux send-keys C-k) \
|
|
|| ($is_fzf && tmux send-keys C-k) \
|
|
|| tmux select-pane -U"
|
|
bind -n C-l run "($is_vim && tmux send-keys C-l) \
|
|
|| tmux select-pane -R"
|
|
bind-key -T copy-mode-vi 'C-h' select-pane -L
|
|
bind-key -T copy-mode-vi 'C-j' select-pane -D
|
|
bind-key -T copy-mode-vi 'C-k' select-pane -U
|
|
bind-key -T copy-mode-vi 'C-l' select-pane -R
|
|
|
|
# Rebinds pane clear which overwritten by the above to {prefix} Ctrl-l
|
|
bind C-l send-keys 'C-l'
|