fix(vim): make sure spell settings are correctly saved/restored
fix(vim): make sure spell settings are correctly saved/restored

I couldn't remember what all this stuff was for when I was porting from
Vimscript to Lua in 0cc3b34b, but I noticed that spelling mistakes were
being highlighted in blurred Markdown windows.

So, I did a bit of digging and I am not sure this was working before. As
it says in a7e4d8b8383a375d124, calling `:ownsyntax` resets the spelling
settings. You could see the old code saving and restoring the settings
after the `:ownsyntax` invocations, but nowhere do I see it setting
`'nospell'` on blurred windows and `'spell'` (if applicable) on focussed
windows.

It's all made more complicated by the fact that we register multiple
autocmds that end up going through the same path eg. `VimEnter`,
`WinEnter`, `BufEnter` and `FocusGained` all call `focus_window()`, and
both `FocusLost` and `WinLeave` call `blur_window()`. So when you start
up Vim, you are going to hit sometimes multiple of those in a row.

So, that's why we have all the delicate state management in there: if we
are blurring, we take a snapshot of the settings, but only once; and if
we are focussing, we do the opposite, and restore the settings, but only
once.

The tricky bits are the `== false` and `~= false` comparisons in
`ownsyntax()`:

- At startup our flag is going to be `nil`.
- If focusing and we have a settings snapshot (ie. flag `== false`), we
  restore. Set flag to `true` to avoid doing this again if we get
  called again.
- If blurring (ie. flag `~= false`), save. Set flag to
  `false` to avoid doing this again if we get called.

wincent/wincent,wincent/wincent,wincent/wincent,wincent/wincent,wincent/wincent,wincent/wincent,wincent/wincent,wincent/wincent