I installed sessionman, and it works fine. But I lose session when reload the X session twice (logout/login, reboot, etc), because when KDE restores Gvim, it does not load session automatically, but only last file, and then saves this under the last session name on next reload. If I did not run SessionOpen then on next reload my last session is lost.
I configured session autosave already. It would be nice if Gvim can load last session automatically too. However, this feature does not work for me even manually. When I restart Gvim, SessionShowLast prints "Last session is undefined, current session is """.
The sessionman documentation says: "The name of an opened session is saved in g:LAST_SESSION variable which is saved in the viminfo file if 'viminfo' option contains '!'". But I have not found any clear explanation what is "viminfo option", where it should contain '!', and how do I set it. Also I'm not sure how to execute SessionOpenLast from vimrc.
If the way I'm trying to fix the problem is wrong then please correct me.