My vim environment occasionally becomes corrupted because of plugin/user errors (e.g. :bdelete in the NERDCommander window), and I'd like to "reload vim".

:mksession allows vim to "save" tabs for reopening, but it also saves the broken environment.

I'm thinking any of these could solve the problem:

  1. :mksession in a way that discards the current vim environment
  2. Somehow load an environment from a fresh vim startup
  3. Automate my manual solution: Export currently open tabs, restart vim, and reopen each tab

You can influence what :mksession persists via the 'sessionoptions' setting. For instance, by removing options from it, changed options and mappings aren't persisted any more.

Also, the saved session is just a Vim script. You can manually / automatically filter out stuff that is broken or not needed. The session.vim - Extended session management for Vim plugin does this sort of postprocessing, too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.