diff --git a/README.md b/README.md index 7ef88ef..884375e 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,10 @@ By default this option is set to `'prompt'`. This means that when you start Vim By default this option is set to `'prompt'`. When you've opened a session and you quit Vim, the session plug-in will ask whether you want to save the changes to your session. Set this option to `'yes'` to always automatically save open sessions when you quit Vim. To completely disable automatic saving you can set this option to `'no'`. +### The `g:session_verbose_messages` option + +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]. + ### The `g:session_default_to_last` option By default this option is set to false (0). When you set this option to true (1) and you start Vim, the session plug-in will open your last used session instead of the default session. Note that the session plug-in will still show you the dialog asking whether you want to restore the last used session. To get rid of the dialog you have to set `g:session_autoload` to `'yes'`. diff --git a/autoload/xolox/session.vim b/autoload/xolox/session.vim index ea8ca31..7cb3114 100644 --- a/autoload/xolox/session.vim +++ b/autoload/xolox/session.vim @@ -3,7 +3,7 @@ " Last Change: May 2, 2013 " URL: http://peterodding.com/code/vim/session/ -let g:xolox#session#version = '1.6.3' +let g:xolox#session#version = '1.6.4' call xolox#misc#compat#check('session', 2) @@ -304,9 +304,12 @@ function! s:prompt(msg, var) if value == 'yes' || (type(value) != type('') && value) return 1 else - let format = "%s Note that you can permanently disable this dialog by adding the following line to your %s script:\n\n\t:let %s = 'no'" - let vimrc = xolox#misc#os#is_win() ? '~\_vimrc' : '~/.vimrc' - let prompt = printf(format, a:msg, vimrc, a:var) + if g:session_verbose_messages + let format = "%s Note that you can permanently disable this dialog by adding the following line to your %s script:\n\n\t:let %s = 'no'" + let prompt = printf(format, a:msg, xolox#misc#os#is_win() ? '~\_vimrc' : '~/.vimrc', a:var) + else + let prompt = a:msg + endif return confirm(prompt, "&Yes\n&No", 1, 'Question') == 1 endif endfunction diff --git a/doc/session.txt b/doc/session.txt index 3d4e8b6..4b9ecf1 100644 --- a/doc/session.txt +++ b/doc/session.txt @@ -20,11 +20,12 @@ Contents ~ 4. The |g:session_extension| option 5. The |g:session_autoload| option 6. The |g:session_autosave| option - 7. The |g:session_default_to_last| option - 8. The |g:session_persist_globals| option - 9. The |g:session_restart_environment| option - 10. The |g:session_command_aliases| option - 11. The |g:loaded_session| option + 7. The |g:session_verbose_messages| option + 8. The |g:session_default_to_last| option + 9. The |g:session_persist_globals| option + 10. The |g:session_restart_environment| option + 11. The |g:session_command_aliases| option + 12. The |g:loaded_session| option 5. Compatibility with other plug-ins |session-compatibility-with-other-plug-ins| 6. Known issues |session-known-issues| 7. Contact |session-contact| @@ -235,6 +236,14 @@ changes to your session. Set this option to 'yes' to always automatically save open sessions when you quit Vim. To completely disable automatic saving you can set this option to 'no'. +------------------------------------------------------------------------------- +The *g:session_verbose_messages* option + +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. + ------------------------------------------------------------------------------- The *g:session_default_to_last* option diff --git a/plugin/session.vim b/plugin/session.vim index 14dceb9..67c5fa7 100644 --- a/plugin/session.vim +++ b/plugin/session.vim @@ -37,9 +37,14 @@ if !exists('g:session_autosave') let g:session_autosave = 'prompt' endif +" Define the verbosity of messages. +if !exists('g:session_verbose_messages') + let g:session_verbose_messages = 1 +endif + " The session plug-in can automatically open sessions in three ways: based on " Vim's server name, by remembering the last used session or by opening the -" session named `default'. Enable this option to use the second approach. +" default session. Enable this option to use the second approach. if !exists('g:session_default_to_last') let g:session_default_to_last = 0 endif