Skip to content

Commit 166f1f7

Browse files
committed
Bug fix: Make auto-load work when 'viminfo' contains '%' (#19)
Issue #19 on GitHub: #19 (comment)
1 parent 8cc18f0 commit 166f1f7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

autoload/xolox/session.vim

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
" Last Change: May 4, 2013
44
" URL: http://peterodding.com/code/vim/session/
55

6-
let g:xolox#session#version = '1.7.2'
6+
let g:xolox#session#version = '1.7.3'
77

88
call xolox#misc#compat#check('session', 2)
99

@@ -250,7 +250,10 @@ function! xolox#session#auto_load() " {{{2
250250
return
251251
endif
252252
" Check that the user has started Vim without editing any files.
253-
if bufnr('$') == 1 && bufname('%') == '' && !&mod && getline(1, '$') == ['']
253+
let current_buffer_is_empty = (&modified == 0 && getline(1, '$') == [''])
254+
let buffer_list_is_empty = (bufnr('$') == 1 && bufname('%') == '')
255+
let buffer_list_is_persistent = (index(xolox#misc#option#split(&viminfo), '%') >= 0)
256+
if current_buffer_is_empty && (buffer_list_is_empty || buffer_list_is_persistent)
254257
" Check whether a session matching the user-specified server name exists.
255258
if v:servername !~ '^\cgvim\d*$'
256259
for session in xolox#session#get_names()

0 commit comments

Comments
 (0)