Fix vim<->tmux pane-switching bindings
This commit is contained in:
parent
75ad3e2252
commit
c47ffb218e
14
tmux.conf
14
tmux.conf
|
@ -47,12 +47,14 @@ unbind '"'
|
|||
bind s split-window -v
|
||||
bind v split-window -h
|
||||
|
||||
# Navigate between panes
|
||||
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"
|
||||
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-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-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-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys 'C-\\') || tmux select-pane -l"
|
||||
# Smart pane switching with awareness of vim splits
|
||||
# See: https://github.com/christoomey/vim-tmux-navigator
|
||||
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?x?)(diff)?$"'
|
||||
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
|
||||
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
|
||||
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
|
||||
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"
|
||||
|
||||
bind H resize-pane -L 5
|
||||
bind J resize-pane -D 5
|
||||
|
|
Loading…
Reference in a new issue