From 1a8b0c1ed7da128ff4b302e66deb51dbf7d1b8ce Mon Sep 17 00:00:00 2001 From: Jidbo Date: Sat, 22 Dec 2018 15:28:44 +0100 Subject: [PATCH] add tmux-vim-navigator plugin --- .vimrc | 9 +++------ tmux.conf | 10 ++++++++++ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.vimrc b/.vimrc index fb29fdd..223ccf7 100644 --- a/.vimrc +++ b/.vimrc @@ -1,9 +1,3 @@ -" if empty(glob("~/.vim/bundle/Vundle.vim")) - " silent !git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim - " autocmd GUIEnter * PluginInstall - " \ source ~/.vimrc -" endif - set nocompatible " required filetype off " required @@ -17,6 +11,9 @@ Plugin 'gmarik/Vundle.vim' " add all your plugins here (note older versions of Vundle " used Bundle instead of Plugin) +" tmux navigator +Plugin 'christoomey/vim-tmux-navigator' + " Simply Fold Plugin 'tmhedberg/SimpylFold' diff --git a/tmux.conf b/tmux.conf index f14f680..ed37510 100644 --- a/tmux.conf +++ b/tmux.conf @@ -2,6 +2,16 @@ # set vi keys set-window-option -g mode-keys vi +is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ + | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" +bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L" +bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D" +bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U" +bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "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 # default statusbar colors set-option -g status-bg black #base02