# HG changeset patch # User zegervdv # Date 1415470920 -3600 # Node ID 925861e874ec63cd4833a9a24a551a2ddf1cf0c7 # Parent 51d25ca2f262f72454765a0b402ee20d8be4281c Add vim-tmux-navigator for seamless navigation diff -r 51d25ca2f262 -r 925861e874ec tmux.conf --- a/tmux.conf Sat Nov 08 19:01:14 2014 +0100 +++ b/tmux.conf Sat Nov 08 19:22:00 2014 +0100 @@ -11,13 +11,20 @@ set -g status-keys vi # bind-key -t vi-edit Up # bind-key -t vi-eidt Down -bind h select-pane -L -bind j select-pane -D -bind k select-pane -U -bind l select-pane -R +# bind h select-pane -L +# bind j select-pane -D +# bind k select-pane -U +# bind l select-pane -R bind-key -r C-h select-window -t :- bind-key -r C-l select-window -t :+ +# Move between tmux and vim seamlessly +bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L" +bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D" +bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U" +bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R" +bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys 'C-\\') || tmux select-pane -l" + #act like GNU screen unbind C-b set -g prefix C-a diff -r 51d25ca2f262 -r 925861e874ec vimrc --- a/vimrc Sat Nov 08 19:01:14 2014 +0100 +++ b/vimrc Sat Nov 08 19:22:00 2014 +0100 @@ -27,6 +27,7 @@ " Tmux Plug 'benmills/vimux', { 'on': 'VimuxRunCommand' } Plug 'edkolev/tmuxline.vim', { 'on': 'TmuxlinSnapshot' } +Plug 'christoomey/vim-tmux-navigator' " Search and Complete Plug 'Shougo/neocomplete' @@ -249,10 +250,10 @@ vnoremap % " Move between splits -map j -map k -map l -map h +" map j +" map k +" map l +" map h " highlight last inserted text nnoremap gV `[v`] @@ -567,7 +568,9 @@ " After-objects {{{ autocmd VimEnter * call after_object#enable('=', ':', '-', '#', ' ') " }}} - +" Vim-tmux-navigator {{{ +" nnoremap :TmuxNavigateLeft +" }}} " Load local vimrc if filereadable($HOME . "/.vimrc.local") source ~/.vimrc.local