Skip to content

Commit

Permalink
Use xolox#misc#cursorhold#register() to setup periodic callback
Browse files Browse the repository at this point in the history
  • Loading branch information
xolox committed Jul 6, 2014
1 parent d98a032 commit cf412a9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -246,7 +246,7 @@ Recently this plug-in switched from reimplementing [:mksession][mksession] to ac
<!-- Start of generated documentation -->

The documentation of the 34 functions below was extracted from
1 Vim scripts on June 18, 2014 at 23:00.
1 Vim scripts on July 6, 2014 at 20:47.

### Public API for the vim-session plug-in

Expand Down
9 changes: 3 additions & 6 deletions autoload/xolox/session.vim
@@ -1,10 +1,10 @@
" Public API for the vim-session plug-in.
"
" Author: Peter Odding
" Last Change: June 18, 2014
" Last Change: July 6, 2014
" URL: http://peterodding.com/code/vim/session/

let g:xolox#session#version = '2.4.14'
let g:xolox#session#version = '2.4.15'

" Public API for session persistence. {{{1

Expand Down Expand Up @@ -484,10 +484,7 @@ function! xolox#session#auto_save_periodic() " {{{2
if g:session_autosave_periodic > 0
let interval = g:session_autosave_periodic * 60
let next_save = s:session_last_flushed + interval
if next_save > localtime()
call xolox#misc#msg#debug("session.vim %s: Skipping this beat of 'updatetime' (it's not our time yet).", g:xolox#session#version)
else
call xolox#misc#msg#debug("session.vim %s: This is our beat of 'updatetime'!", g:xolox#session#version)
if localtime() > next_save
let name = xolox#session#find_current_session()
if !empty(name)
if xolox#session#is_tab_scoped()
Expand Down
2 changes: 1 addition & 1 deletion doc/session.txt
Expand Up @@ -490,7 +490,7 @@ might take a while...)
Function reference ~

The documentation of the 34 functions below was extracted from 1 Vim scripts on
June 18, 2014 at 23:00.
July 6, 2014 at 20:47.

-------------------------------------------------------------------------------
*public-api-for-vim-session-plug-in*
Expand Down
5 changes: 3 additions & 2 deletions plugin/session.vim
@@ -1,6 +1,6 @@
" Vim script
" Author: Peter Odding
" Last Change: July 4, 2013
" Last Change: June 22, 2014
" URL: http://peterodding.com/code/vim/session/

" Support for automatic update using the GLVS plug-in.
Expand Down Expand Up @@ -145,11 +145,12 @@ endif
augroup PluginSession
autocmd!
au VimEnter * nested call xolox#session#auto_load()
au CursorHold,CursorHoldI * call xolox#session#auto_save_periodic()
au VimLeavePre * call xolox#session#auto_save()
au VimLeavePre * call xolox#session#auto_unlock()
augroup END

call xolox#misc#cursorhold#register({'function': 'xolox#session#auto_save_periodic', 'interval': 60})

" Plug-in commands (user defined commands). {{{1

" Define commands that enable users to manage multiple named, heavy-weight
Expand Down

0 comments on commit cf412a9

Please sign in to comment.