There's nothing built-in; I guess the reasoning is that spelling (at least for a certain language) is inherently global. Any differences should be reflected in the language / dialect chosen.
You can implement such buffer-local spelling exception yourself: Get a temp file via tempname()
, prepend it to 'spellfile'
, and then zg
/ 1zg
will place the exception there. This would be local to a single Vim session (like zG
).
If you would like persistent buffer-local spelling, instead of tempname()
, either put the spell file next to the file (bufname('') . '.spl'
), or place then all into a dedicated spell directory, encoding the original file path in a way that :mkview
does: replace the path separator with =+
and =
with ==
. So, ~/foo/bar.txt
would get a spellfile of /path/to/spelldir/~=+foo=+bar.txt.spl