fix tmux window switching

This commit is contained in:
Thomas Ruoff
2017-08-30 23:07:24 +02:00
parent 09ab78b86c
commit 9969fc422f

View File

@@ -16,16 +16,20 @@ unbind C-b
set -g prefix C-a set -g prefix C-a
bind C-a send-prefix bind C-a send-prefix
# window switching # Smart pane switching with awareness of Vim splits.
bind -n C-h select-window -t:- # See: https://github.com/christoomey/vim-tmux-navigator
bind -n C-l select-window -t:+ is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
# smart pane switching with awareness of vim splits bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -nr C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L" bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -nr C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D" bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -nr C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U" bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind -nr C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R" bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
bind -nr C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys 'C-\\') || tmux select-pane -l" 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
bind-key -T copy-mode-vi C-\ select-pane -l
# splitting panes # splitting panes
bind | split-window -h bind | split-window -h