Created
April 6, 2018 23:44
-
-
Save max-b/0506f853e04a2431a66a730614474894 to your computer and use it in GitHub Desktop.
Example of tmux config with more than 2 conditional bindings to single key. Useful for vim-tmux-navigation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Smart pane switching with awareness of vim and fzf and ctrlp | |
forward_programs="view|n?vim?|ctrlp" | |
should_forward="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?($forward_programs)(diff)?$'" | |
bind -n C-h if-shell "$should_forward" "send-keys C-h" "run-shell '[ #{pane_at_left} -eq 1 ] && tmux previous-window || tmux select-pane -L'" | |
bind -n C-l if-shell "$should_forward" "send-keys C-l" "run-shell '[ #{pane_at_right} -eq 1 ] && tmux next-window || tmux select-pane -R'" | |
bind -n C-j if-shell "$should_forward" "send-keys C-j" "select-pane -D" | |
bind -n C-k if-shell "$should_forward" "send-keys C-k" "select-pane -U" | |
bind -n C-\ if-shell "$should_forward" "send-keys C-\\" "select-pane -l" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment