set sessionoptions+=globals
if !exists('g:EGbufs')
if exists('g:EGbufsstring')
exe "let g:EGbufs=".g:EGbufsstring
else
let g:EGbufs = {}
endif
endif
I have this in my .vimrc.
When I load a session, I can :echo g:EGbufsstring
for the right result.
But for some reason, my second exists conditional fails, and so g:EGbufs
is set to a empty dictionary. There might be another bug, but I've used echo and echoerr around this code to check the value of the string and it tells me the variable doesn't exist.
Does a vimsession get loaded AFTER the .vimrc? The only work around I can think of is writing to a file the string I want to load, and reading it in the vimrc. I'm already trying to work around lack of support for saving dictionaries in a session. I guess my other option is to run this load conditional in the function that I need it, but that's just a little ugly.
UPDATE:
Ah, I thought I had it with autocmd SessionLoadPost call LoadBufsString()
but I can't seem to make it work. Thought it might be because it only triggers on manual :mks
but that is not the case either. Probably I just need to sort out the syntax.
s
inEGbufSString
- or you have a typo in the question? – grodzik Dec 29 '16 at 20:10