0

I wanna save the state of a variable (say, background) such that the state is restored next time I start vim.

More in detail, it should work like this:

  1. I set background to either dark or light.
  2. I open a new instance of VIM. (I may or may not have quit out of the old instance first)
  3. On startup of the new instance, background is automatically set to the value set in 1.

I could probably hand-code a command that sets the variable, writes its value to some file, and have the file read on startup. But perhaps there's an easier way to get what I want?

3
  • 2
    :help viminfo-!
    – Matt
    Mar 25 at 15:43
  • @Matt ah nice, this is prob gonna do it! I saw I can also write this manually via :wv, so I can save the setting for instances starting in parallel. Thx!
    – srs
    Mar 25 at 17:37
  • 1
    Welcome to Vi and Vim! Make sure to add an answer if you solve your problem!
    – D. Ben Knoble
    Mar 25 at 19:56

Your Answer

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

Browse other questions tagged or ask your own question.