Skip to content

Commit 4664cc7

Browse files
committed
Bug fix: Don't persist &go and &gfn when !has('gui') (issue #54)
Issue #54 on GitHub: #54
1 parent cd6ef28 commit 4664cc7

File tree

2 files changed

+31
-26
lines changed

2 files changed

+31
-26
lines changed

autoload/xolox/session.vim

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
" Vim script
22
" Author: Peter Odding
3-
" Last Change: June 1, 2013
3+
" Last Change: June 6, 2013
44
" URL: http://peterodding.com/code/vim/session/
55

6-
let g:xolox#session#version = '2.3.10'
6+
let g:xolox#session#version = '2.3.11'
77

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

@@ -23,7 +23,12 @@ function! xolox#session#save_session(commands, filename) " {{{2
2323
if &verbose >= 1
2424
call add(a:commands, 'set verbose=' . &verbose)
2525
endif
26-
if is_all_tabs
26+
" We save the GUI options only for global sessions, not for tab scoped
27+
" sessions. Also, if the Vim we're currently running in doesn't have GUI
28+
" support, Vim will report &go as an empty string. We should never persist
29+
" this value if the user didn't specifically set it! Otherwise the next time
30+
" the session is restored in a GUI Vim, things will look funky :-).
31+
if has('gui') && is_all_tabs
2732
call add(a:commands, 'set guioptions=' . escape(&go, ' "\'))
2833
call add(a:commands, 'silent! set guifont=' . escape(&gfn, ' "\'))
2934
endif

doc/session.txt

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,31 @@ Contents ~
66
1. Introduction |session-introduction|
77
2. Installation |session-installation|
88
3. Commands |session-commands|
9-
1. The :SaveSession command
10-
2. The :OpenSession command
11-
3. The :RestartVim command
12-
4. The :CloseSession command
13-
5. The :DeleteSession command
14-
6. The :ViewSession command
9+
1. The |:SaveSession| command
10+
2. The |:OpenSession| command
11+
3. The |:RestartVim| command
12+
4. The |:CloseSession| command
13+
5. The |:DeleteSession| command
14+
6. The |:ViewSession| command
1515
7. Tab scoped sessions |tab-scoped-sessions|
16-
1. The :OpenTabSession command
17-
2. The :SaveTabSession command
18-
3. The :AppendTabSession command
19-
4. The :CloseTabSession command
16+
1. The |:OpenTabSession| command
17+
2. The |:SaveTabSession| command
18+
3. The |:AppendTabSession| command
19+
4. The |:CloseTabSession| command
2020
4. Options |session-options|
21-
1. The sessionoptions setting
22-
2. The g:session_directory option
23-
3. The g:session_default_name option
24-
4. The g:session_extension option
25-
5. The g:session_autoload option
26-
6. The g:session_autosave option
27-
7. The g:session_autosave_periodic option
28-
8. The g:session_verbose_messages option
29-
9. The g:session_default_to_last option
30-
10. The g:session_persist_globals option
31-
11. The g:session_restart_environment option
32-
12. The g:session_command_aliases option
33-
13. The g:loaded_session option
21+
1. The |sessionoptions| setting
22+
2. The |g:session_directory| option
23+
3. The |g:session_default_name| option
24+
4. The |g:session_extension| option
25+
5. The |g:session_autoload| option
26+
6. The |g:session_autosave| option
27+
7. The |g:session_autosave_periodic| option
28+
8. The |g:session_verbose_messages| option
29+
9. The |g:session_default_to_last| option
30+
10. The |g:session_persist_globals| option
31+
11. The |g:session_restart_environment| option
32+
12. The |g:session_command_aliases| option
33+
13. The |g:loaded_session| option
3434
5. Compatibility with other plug-ins |session-compatibility-with-other-plug-ins|
3535
6. Known issues |session-known-issues|
3636
7. Contact |session-contact|

0 commit comments

Comments
 (0)