Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

replace tmux script with vim-tmux-navigator plugin

Thanks, @christoomey!
  • Loading branch information...
commit 799089104afdebcd22b6aa17f92dba1ef073e3c3 1 parent 0c630e1
@mislav authored
Showing with 4 additions and 38 deletions.
  1. +3 −0  .gitmodules
  2. +1 −0  bundle/tmux-navigator
  3. +0 −38 plugin/tmux_navigator.vim
View
3  .gitmodules
@@ -82,3 +82,6 @@
[submodule "bundle/visual-star-search"]
path = bundle/visual-star-search
url = https://github.com/nelstrom/vim-visual-star-search
+[submodule "bundle/tmux-navigator"]
+ path = bundle/tmux-navigator
+ url = https://github.com/christoomey/vim-tmux-navigator
1  bundle/tmux-navigator
@@ -0,0 +1 @@
+Subproject commit f0a3f6dc5d9299999addc4d45bf25c294275e3a6
View
38 plugin/tmux_navigator.vim
@@ -1,38 +0,0 @@
-" Maps <C-h/j/k/l> to switch vim splits in the given direction. If there are
-" no more windows in that direction, forwards the operation to tmux.
-" Additionally, <C-\> toggles between last active vim splits/tmux panes.
-
-if $TMUX != ''
-
- let s:tmux_is_last_pane = 0
- au WinEnter * let s:tmux_is_last_pane = 0
-
- " Like `wincmd` but also change tmux panes instead of vim windows when needed.
- function s:TmuxWinCmd(direction)
- let nr = winnr()
- let tmux_last_pane = (a:direction == 'p' && s:tmux_is_last_pane)
- if !tmux_last_pane
- " try to switch windows within vim
- exec 'wincmd ' . a:direction
- endif
- " Forward the switch panes command to tmux if:
- " a) we're toggling between the last tmux pane;
- " b) we tried switching windows in vim but it didn't have effect.
- if tmux_last_pane || nr == winnr()
- let cmd = 'tmux select-pane -' . tr(a:direction, 'phjkl', 'lLDUR')
- call system(cmd)
- let s:tmux_is_last_pane = 1
- echo cmd
- else
- let s:tmux_is_last_pane = 0
- endif
- endfunction
-
- " navigate between split windows/tmux panes
- nmap <c-j> :call <SID>TmuxWinCmd('j')<cr>
- nmap <c-k> :call <SID>TmuxWinCmd('k')<cr>
- nmap <c-h> :call <SID>TmuxWinCmd('h')<cr>
- nmap <c-l> :call <SID>TmuxWinCmd('l')<cr>
- nmap <c-\> :call <SID>TmuxWinCmd('p')<cr>
-
-end
Please sign in to comment.
Something went wrong with that request. Please try again.