2

It is possible to set nospell in .vimrc to disable it globally. But it doesn't override filetype plugins.

Is it possible to toggle between spell and nospell globally so that I can at least disable it once for all open buffers?

2 Answers 2

2

To turn spell on for all the open buffers I would do:

:bufdo set spell

And to turn spell off for all the open buffer I would do:

:bufdo set nospell

For some filetype the standard change the general spell settings. You can override that by adding an after script.

e.g.: If you want to activate spell for the python filetype you could add: .vimfiles/after/ftplugin/python.vim with the following content:

setlocal spell
2

You might be able to make use of a VimEnter autocommand in conjunction with an OptionSet autocommand, the reason being, that OptionSet is not triggered during startup and loading of runtime files during that time.

So the following may work:

augroup MyCustomGroup
au!
au VimEnter * ++once :set nospell
au OptionSet spell :setl nospell

If the VimEnter still triggers to early, you may have to fallback to a custom timer.

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.