xolox / vim-session

Extended session management for Vim (:mksession on steroids)
http://peterodding.com/code/vim/session/
961 stars 80 forks source link

Missing/stale functions/mappings after some plugins get installed or removed #187

Open iFork opened 4 years ago

iFork commented 4 years ago

Only sessionoptions in my .vimrc are

set sessionoptions-=help
set sessionoptions-=buffers

and per manual we know that vim-session plug-in automatically and unconditionally executes

" Don't persist options and mappings because it can corrupt sessions.
set sessionoptions-=options

I do SaveSession, then uninstall a plugin (e.g. splitjoin or auto-pair, I use vim-plug). Afterwards, when I OpenSession, there are stale mappings still available which when triggered give errors that they cannot find certain functions (from deleted plugins). When I install new plugin and OpenSession, mappings/functions of the new plugin become unavailable. In both cases I need to put together a session from scratch.

Are there other options which I need to remove from sessionoptions or other workarounds to make sessions survive plugin changes?

EDIT: Also after plugin update, plugin may fail to load on startup. For example, after updating coc extension coc-eslint, coc reported that it cannot load ESlint library for a file and related mappings had no effect. Not loading the session solved the issue. It would save from a headache if, at least, some message from vim-session appeared suggesting that (some) new occurred issue may be due to stale session script and user needs to discard the old session first before going to the issue tracker of the failing plugin :)