diff --git a/plugin/obsession.vim b/plugin/obsession.vim index e36729d..ef2a998 100644 --- a/plugin/obsession.vim +++ b/plugin/obsession.vim @@ -75,8 +75,13 @@ function! s:persist() abort execute 'mksession!' fnameescape(tmp) let v:this_session = g:this_obsession let body = readfile(tmp) - call insert(body, 'let g:this_session = v:this_session', -3) - call insert(body, 'let g:this_obsession = v:this_session', -3) + if body[0] ==# 'vim9script' + call insert(body, 'g:this_session = v:this_session', -3) + call insert(body, 'g:this_obsession = v:this_session', -3) + else + call insert(body, 'let g:this_session = v:this_session', -3) + call insert(body, 'let g:this_obsession = v:this_session', -3) + endif if type(get(g:, 'obsession_append')) == type([]) for line in g:obsession_append call insert(body, line, -3)