如何在 vim 中标记要用不同语言进行拼写检查或根本不进行拼写检查的块?

How to mark a block to be spellchecked in a different language or not at all in vim?

我正在 Vim 中编辑文档。有些部分是英语,有些是荷兰语。比方说,我有以下

A common form of lorem ipsum reads:

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

"Lorem ipsum" text is derived from sections 1.10.33 of Cicero's De finibus bonorum et malorum.

现在,在进行拼写检查时,我想将第二段(或任何块,真的)标记为用不同的语言进行拼写检查。或者,或者,根本不进行拼写检查。这可能吗?

有问题的文档是 markdown。

I'd like to mark the second paragraph (or any block, really) to be spellchecked in a different language.

对此有一个简单但不令人满意的答案:你不能这样做。对不起:-(

您最好使用 :set spelllang=en_gb,nl,因此它会检查两种语言:


alternatively, to not be spellchecked at all

可以 通过使用 contains=@NoSpell 添加新语法组来完成。参见 :help :syn-spell。不过,确实需要您制定一些语法规则。

有关示例,另请参阅 Is it possible to turn on spell-checking for only parts of buffers? as well as this answer