1

I have a Vim Session file I created by doing:

:mksession

Then I quit Vim. I then downloaded a plugin to:

${HOME}/.vim/pack/vendor/start/vim-markdown-folding

and then I fired up Vim with the session file by doing

vim -S Session.vim

Then I attempted to open the help docs for the vim-markdown-folding plugin by doing:

:helptags ALL
:help markdown-folding

Which Vim told me that it didn't exist. So I opened a new terminal tab, and tried it in a different vim session without loading the Session file. The help command worked. So I tried then to :source $MYVIMRC in the Vim that loaded the Session.vim and it still didn't update the loaded plugins. The only other way I can think of to do this is to delete the Session.vim file and reposition all my open splits and windows, which I DO NOT want to do.

How do I make Vim update the Session.vim file and the list of plugins that should be loaded when editing certain files without deleting the existing Session.vim and losing all those settings?

Why would the Session.vim file detail the plugins loaded or not update them when I tell it to :packadd or to :mksession! again or reload my $MYVIMRC?

Comment Chat is here

  • 2
    What is set ssop? Especially, does it include options? – Matt Jun 28 at 6:38
  • I don't have ssop set anywhere in my vimrc. I did a recursive grep through the plugins I have, and nothing is in there either. – FilBot3 Jun 28 at 13:15
  • There is also no ssop setting in the Session.vim file. – FilBot3 Jun 28 at 13:16
  • What I asked is the value of 'ssop'. If you haven't touched it then it does include options and then it's no surprise it worked that way. Read :h 'ssop' and :h 'rtp' then have a look into your session file, and you probaly will be able to explain what happens yourself. – Matt Jun 28 at 13:24
  • my default :set sessionoptions? is sessionoptions=blank,buffers,curdir,folds,help,options,tabpages,winsize,terminal – FilBot3 Jun 28 at 13:43
1

With the help of @Matt, we were able to get my new plugins loaded, and markdown folds working.

  1. Open vim with the session file

    vim -S Session.vim

  2. Modify sessionoptions by removing options and folds from the sesion options

-- :set sessionoptions=blank,buffers,curdir,folds,help,options,tabpages,winsize,terminal
++ :set sessionoptions=blank,buffers,curdir,help,tabpages,winsize,terminal
  1. Save the session

    :mksession

  2. Quit and restart Vim with the session file again.

    • This should load up all the new plugins that were added after the initial plugins were saved in the session file. This will also allow any folding plugins to perform their function.
  3. With all the new plugins loaded, folds set, check the sessionoptions again. It should have the original options set.

  4. Save the session again.

    :mksession!

  5. Quit and start Vim again with the Session file.

This should have all the relevant packages loaded, folds set, and windows in their position. To help make this easier and quicker to run the following

vim -S Session.vim \
    -c "set sessionoptions=blank,buffers,curdir,help,tabpages,winsize,terminal" \
    -c "mksession!" \
    -c "q"

vim -S Session.vim \
    -c "mksession!" \
    -c "q"
| improve this answer | |

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.