Permalink
Browse files

Add initial doc file, update autosave code

  • Loading branch information...
1 parent 58f4346 commit d25c7ebb65a0ca3058d075158ce1b6605c954c82 @m42e m42e committed with Aug 20, 2014
Showing with 47 additions and 2 deletions.
  1. +8 −0 README.mkd
  2. +33 −0 doc/tmux-navigator.txt
  3. +6 −2 plugin/tmux_navigator.vim
View
@@ -87,6 +87,14 @@ nnoremap <silent> {Previous-Mapping} :TmuxNavigatePrevious<cr>
in the above code with the desired mapping. Ie, the mapping for `<ctrl-h>` =>
Left would be created with `nnoremap <silent> <c-h> :TmuxNavigateLeft<cr>`.
+
+##### Autosave on leave
+
+ let g:tmux_navigator_save_on_switch = 1
+
+This will execute the update command on leaving vim to a tmux pane. Default is Zero
+
+
#### Tmux
Alter each of the five lines of the tmux configuration listed above to use your
@@ -0,0 +1,33 @@
+*tmux-navigator.txt* Plugin to allow seamless navigation between tmux and vim
+
+==============================================================================
+CONTENTS *tmux-navigator-contents*
+
+
+==============================================================================
+INTRODUCTION *tmux-navigator*
+
+Vim-tmux-navigator is a little plugin which enables seamless navigation
+between tmux panes and vim splits. This plugin is a repackaging of Mislav
+Marohinc's tmux=navigator configuration. When combined with a set of tmux key
+bindings, the plugin will allow you to navigate seamlessly between vim and
+tmux splits using a consistent set of hotkeys.
+
+NOTE: This requires tmux v1.8 or higher.
+
+==============================================================================
+CONFIGURATION *tmux-navigator-configuration*
+
+* Activate autoupdate on exit
+ let g:tmux_navigator_save_on_switch = 1
+
+* Custom Key Bindings
+ let g:tmux_navigator_no_mappings = 1
+
+ nnoremap <silent> {Left-mapping} :TmuxNavigateLeft<cr>
+ nnoremap <silent> {Down-Mapping} :TmuxNavigateDown<cr>
+ nnoremap <silent> {Up-Mapping} :TmuxNavigateUp<cr>
+ nnoremap <silent> {Right-Mapping} :TmuxNavigateRight<cr>
+ nnoremap <silent> {Previous-Mapping} :TmuxNavigatePrevious<cr>
+
+ vim:tw=78:ts=8:ft=help:norl:
@@ -7,6 +7,10 @@ if exists("g:loaded_tmux_navigator") || &cp || v:version < 700
endif
let g:loaded_tmux_navigator = 1
+if !exists("g:tmux_navigator_save_on_switch")
+ let g:tmux_navigator_save_on_switch = 0
+endif
+
function! s:UseTmuxNavigatorMappings()
return !exists("g:tmux_navigator_no_mappings") || !g:tmux_navigator_no_mappings
endfunction
@@ -46,8 +50,8 @@ function! s:TmuxAwareNavigate(direction)
" 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()
- if exists('g:tmux_navigator_save_on_switch')
- update
+ if g:tmux_navigator_save_on_switch
+ update
endif
let cmd = 'tmux select-pane -' . tr(a:direction, 'phjkl', 'lLDUR')
silent call system(cmd)

0 comments on commit d25c7eb

Please sign in to comment.