Add initial doc file, update autosave code

This commit is contained in:
Matthias Bilger 2014-08-20 12:45:15 +02:00 committed by Chris Toomey
parent 58f43461e3
commit d25c7ebb65
3 changed files with 47 additions and 2 deletions

View file

@ -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

33
doc/tmux-navigator.txt Normal file
View file

@ -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:

View file

@ -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)