Use new syntax for smart pane navigation

As recommended in original source. As opposed to failing with a message that the command returned 1 and losing access to everything on this screen, this will warn on the status bar if only one pane is present.
This commit is contained in:
Adrian Perez 2016-01-02 00:55:36 +01:00
parent 864794c696
commit 9385536e70

View File

@ -22,11 +22,12 @@ bind -r L resize-pane -R 5
# Smart pane switching with awareness of vim splits. # Smart pane switching with awareness of vim splits.
# Source: https://github.com/christoomey/vim-tmux-navigator # Source: https://github.com/christoomey/vim-tmux-navigator
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys C-h) || tmux select-pane -L" is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?x?)(diff)?$"'
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys C-j) || tmux select-pane -D" bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys C-k) || tmux select-pane -U" bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys C-l) || tmux select-pane -R" bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys 'C-\\') || tmux select-pane -l" 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"
# Use vi keybindings for tmux commandline input. # Use vi keybindings for tmux commandline input.
# Note that to get command mode you need to hit ESC twice... # Note that to get command mode you need to hit ESC twice...