vim 是否能够检测文件的自然语言,然后加载正确的字典?
我正在使用多种语言,目前我必须向 vim 指示必须使用其中哪种语言进行拼写检查。有没有一种方法可以设置 vim 以便它自动检测正确的?我依稀记得在vim的以前版本中,当拼写检查没有集成时,vimspell脚本使这成为可能。
如果这不仅适用于一个文件,而且适用于文件的一部分,那就更好了,因为我经常在一个文件中混合多种语言。当然,我想避免同时加载多个词典。
I am using several languages, and currently I am obliged to indicate to vim with which of these the spell check must be done. Is there a way to set up vim so that it automatically detects the correct one? I vaguely remember that in a previous version of vim, when the spell check was not integrated, the vimspell script made this possible.
It would be even better if this could apply not only to a file but also to a portion of a file, since I frequently mix several languages in a single file. Of course, I would like to avoid to load several dictionaries simultaneously.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不知道是否有办法自动检测它,但是如果你将
vim:spell:spelllang=foo,bar,baz
放在文件底部,vim 会将拼写检查语言设置为文件打开时显示 foo、bar 和 baz。请注意,您必须在该文本之前至少放置一个空格,否则 vim 会认为它是文件的一部分。I don't know if there is a way to autodetect it, but if you put
vim:spell:spelllang=foo,bar,baz
at the bottom of the file, vim will set the spellchecking languages to foo, bar, and baz when the file is opened. Note that you must put at least one space before that text, or vim will think it's part of the file.由于 vim 缺少此功能,我发现在 .vimrc 中定义如下快捷方式很有用:
Since vim is missing this feature, I found it useful to define shortcuts like these in .vimrc: