Skip to content

Commit

Permalink
Issue #128: Make saving of GUI font optional
Browse files Browse the repository at this point in the history
Issue 128 on GitHub:
  #128
  • Loading branch information
xolox committed Sep 4, 2015
1 parent 5642089 commit 397d637
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -183,6 +183,12 @@ The session load/save prompts are quite verbose by default because they explain

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'`.

### The `g:session_persist_font` option

By default the plug-in will save the GUI font with the session to be reused the next time that session is loaded, this can be disabled by adding the following line to your [vimrc script] [vimrc]:

:let g:session_persist_font = 0

### The `g:session_persist_colors` option

By default the plug-in will save the color scheme and the ['background' option] [bg] with the session to be reused the next time that session is loaded, this can be disabled by adding the following line to your [vimrc script] [vimrc]:
Expand Down
8 changes: 5 additions & 3 deletions autoload/xolox/session.vim
@@ -1,10 +1,10 @@
" Public API for the vim-session plug-in.
"
" Author: Peter Odding
" Last Change: July 8, 2015
" Last Change: September 4, 2015
" URL: http://peterodding.com/code/vim/session/

let g:xolox#session#version = '2.12'
let g:xolox#session#version = '2.13'

" Public API for session persistence. {{{1

Expand Down Expand Up @@ -40,7 +40,9 @@ function! xolox#session#save_session(commands, filename) " {{{2
" the session is restored in a GUI Vim, things will look funky :-).
if has('gui') && is_all_tabs
call add(a:commands, 'set guioptions=' . escape(&go, ' "\'))
call add(a:commands, 'silent! set guifont=' . escape(&gfn, ' "\'))
if xolox#misc#option#get('session_persist_font', 1)
call add(a:commands, 'silent! set guifont=' . escape(&gfn, ' "\'))
endif
endif
call xolox#session#save_globals(a:commands)
if is_all_tabs
Expand Down
24 changes: 17 additions & 7 deletions doc/session.txt
Expand Up @@ -32,13 +32,14 @@ Contents ~
12. The |g:session_autosave_silent| option
13. The |g:session_verbose_messages| option
14. The |g:session_default_to_last| option
15. The |g:session_persist_colors| option
16. The |g:session_persist_globals| option
17. The |g:session_restart_environment| option
18. The |g:session_command_aliases| option
19. The |g:session_menu| option
20. The |g:session_name_suggestion_function| option
21. The |g:loaded_session| option
15. The |g:session_persist_font| option
16. The |g:session_persist_colors| option
17. The |g:session_persist_globals| option
18. The |g:session_restart_environment| option
19. The |g:session_command_aliases| option
20. The |g:session_menu| option
21. The |g:session_name_suggestion_function| option
22. The |g:loaded_session| option
5. Compatibility with other plug-ins |session-compatibility-with-other-plug-ins|
6. Function reference |session-function-reference|
1. Public API for the vim-session plug-in |public-api-for-vim-session-plug-in|
Expand Down Expand Up @@ -409,6 +410,15 @@ 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'".

-------------------------------------------------------------------------------
The *g:session_persist_font* option

By default the plug-in will save the GUI font with the session to be reused the
next time that session is loaded, this can be disabled by adding the following
line to your |vimrc| script:
>
:let g:session_persist_font = 0
<
-------------------------------------------------------------------------------
The *g:session_persist_colors* option

Expand Down

0 comments on commit 397d637

Please sign in to comment.