3

I want to have a persisting vim setting in my workspace. The vim plugin vim-workspace seems to be the obvious solution for this. Yet it does not save some options.

For instance I want to have my spell checking enabled in one file and also set the spell dictionary. When I use set spellfile=./en.utf-8.add and set spell spelllang=en. The options are activated but when I qa and open vim again all buffers are loaded but the spell checking is disabled again.

I do not find anything in the help.

Thanks

1 Answer 1

1

Vim persists your workspace settings by writing/reading relevant workspace information into/from a session-file. What kind of data gets written into that file is dictated by sessionoptions, the contents of which you can inspect with :set sessionoptions?.

When you enabled the global spellcheck option with :set spell and then had your workspace information saved into the session-file, my guess is that Vim ignored including that global spellcheck option because sessionoptions was not configured to save global options yet. You should verify that by checking whether options(i.e. global options) is listed in the result of :set sessionoptions? and if it indeed is not listed, you can tell Vim to start tracking them by appending options onto sessionoptions with :set sessionoptions+=options. New sessions should contain all global options henceforth. You would probably want to place that command in your vimrc.

.. I want to have my spell checking enabled in one file ...

If you intend to have an option that is only applicable locally e.g. :setlocal spell, you can start tracking localoptions in your sessions with: set sessionoptions+=localoptions.

About vim-workspace — as far as I can tell from it's description, all it seems to do is manage your session-file for you, so you could probably rule it out as a potential source of interference.

1
  • 1
    Thanks for pointing the sessionoptions. I thought this was a feature that would come with vim-workspace. With your input I got my desired behavior. Important was to set sessionoptions+=localoptions after the import of the plugin in the vimrc. One thing I do not get is that using set sessionoptions+=options does not change the output of set seesionoptions?. I put it in the end of the .vimrc and as far as I understand none of my other vim scripts gets loaded afterwards.
    – john
    Commented May 23, 2022 at 8:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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