diff --git a/README.md b/README.md index 392a405..b166b48 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,14 @@ Or let g:gitsessions_dir = '/absolute/path/' + +If you don't want the session to be loaded automatically when launching vim, +you can disable this behavior: + + let g:gitsessions_disable_auto_load = 1 + +You need to set this variable _before_ loading the plugin. + ### Misc *plugin updates* diff --git a/plugin/gitsessions.vim b/plugin/gitsessions.vim index c45fdaf..fec4567 100644 --- a/plugin/gitsessions.vim +++ b/plugin/gitsessions.vim @@ -177,7 +177,9 @@ endfunction augroup gitsessions autocmd! - autocmd VimEnter * :call g:GitSessionLoad() + if ! exists("g:gitsessions_disable_auto_load") + autocmd VimEnter * :call g:GitSessionLoad() + endif autocmd BufEnter * :call g:GitSessionUpdate(0) autocmd VimLeave * :call g:GitSessionUpdate() augroup END