Skip to content

Commit 7aa90d4

Browse files
committed
Enable silencing automatic periodic sessions saving
Refer to issue 120 on GitHub for details: #120
1 parent 5c3ab85 commit 7aa90d4

3 files changed

Lines changed: 33 additions & 13 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@ This option sets the interval in minutes for automatic, periodic saving of activ
162162

163163
Note that when the plug-in automatically saves a session (because you enabled this feature) the plug-in will not prompt for your permission.
164164

165+
### The `g:session_autosave_silent` option
166+
167+
If you set this option to true (1) the messages normally emitted by automatic, periodic saving of active sessions are silenced.
168+
165169
### The `g:session_verbose_messages` option
166170

167171
The session load/save prompts are quite verbose by default because they explain how to disable the prompts. If you find the additional explanation distracting you can lower the verbosity by setting this option to 0 (false) in your [vimrc script] [vimrc].

autoload/xolox/session.vim

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
" Public API for the vim-session plug-in.
22
"
33
" Author: Peter Odding
4-
" Last Change: March 15, 2015
4+
" Last Change: July 8, 2015
55
" URL: http://peterodding.com/code/vim/session/
66

7-
let g:xolox#session#version = '2.10.1'
7+
let g:xolox#session#version = '2.11'
88

99
" Public API for session persistence. {{{1
1010

@@ -491,9 +491,18 @@ function! xolox#session#auto_save_periodic() " {{{2
491491
let name = xolox#session#find_current_session()
492492
if !empty(name)
493493
if xolox#session#is_tab_scoped()
494-
call xolox#session#save_tab_cmd(name, '', 'SaveTabSession')
494+
let function = 'xolox#session#save_tab_cmd'
495+
let arguments = [name, '', 'SaveTabSession']
495496
else
496-
call xolox#session#save_cmd(name, '', 'SaveSession')
497+
let function = 'xolox#session#save_cmd'
498+
let arguments = [name, '', 'SaveSession']
499+
endif
500+
if xolox#misc#option#get('session_autosave_silent', 0)
501+
" Silence informational messages perceived as noisy.
502+
" https://github.com/xolox/vim-session/issues/120
503+
silent call call(function, arguments)
504+
else
505+
call call(function, arguments)
497506
endif
498507
endif
499508
endif

doc/session.txt

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,16 @@ Contents ~
2828
8. The |g:session_autoload| option
2929
9. The |g:session_autosave| option
3030
10. The |g:session_autosave_periodic| option
31-
11. The |g:session_verbose_messages| option
32-
12. The |g:session_default_to_last| option
33-
13. The |g:session_persist_colors| option
34-
14. The |g:session_persist_globals| option
35-
15. The |g:session_restart_environment| option
36-
16. The |g:session_command_aliases| option
37-
17. The |g:session_menu| option
38-
18. The |g:session_name_suggestion_function| option
39-
19. The |g:loaded_session| option
31+
11. The |g:session_autosave_silent| option
32+
12. The |g:session_verbose_messages| option
33+
13. The |g:session_default_to_last| option
34+
14. The |g:session_persist_colors| option
35+
15. The |g:session_persist_globals| option
36+
16. The |g:session_restart_environment| option
37+
17. The |g:session_command_aliases| option
38+
18. The |g:session_menu| option
39+
19. The |g:session_name_suggestion_function| option
40+
20. The |g:loaded_session| option
4041
5. Compatibility with other plug-ins |session-compatibility-with-other-plug-ins|
4142
6. Known issues |session-known-issues|
4243
7. Function reference |session-function-reference|
@@ -367,6 +368,12 @@ active sessions. The default is zero which disables the feature.
367368
Note that when the plug-in automatically saves a session (because you enabled
368369
this feature) the plug-in will not prompt for your permission.
369370

371+
-------------------------------------------------------------------------------
372+
The *g:session_autosave_silent* option
373+
374+
If you set this option to true (1) the messages normally emitted by automatic,
375+
periodic saving of active sessions are silenced.
376+
370377
-------------------------------------------------------------------------------
371378
The *g:session_verbose_messages* option
372379

0 commit comments

Comments
 (0)