我怎样才能在gVim中拼写检查?

51 vim spell-checking

在gVim中拼写检查的最佳方法是什么?有加载项还是什么?我希望它也提供更正.

Eri*_*son 100

使用:set spell打开拼写检查.如果是源代码,gvim足够聪明,只能拼写检查注释和字符串文字.

:help spell会给你所有的细节.以下是一些摘录:

To search for the next misspelled word:

]s           Move to next misspelled word after the cursor.
             A count before the command can be used to repeat.
             'wrapscan' applies.

[s           Like "]s" but search backwards, find the misspelled
             word before the cursor.  
Finding suggestions for bad words:

z=           For the word under/after the cursor, suggest correctly
             spelled words.
To add words to your own word list:

zg           Add word under the cursor as a good word

另请参阅:help set spelllang有关更改字典以包括其他区域,语言或单词集(例如,医学术语)的信息.

必须使用| + syntax |编译gvim.

我没有放入:set spell我的.vimrc,因为当我编码时,我的评论中有太多变量名称被标记.如果要检查某种文件类型,请在.vimrc中使用自动命令.或者只需在需要时手动打开它.

  • 在gvim上,将光标放在拼写错误的单词上并单击鼠标右键.建议列表将显示在上下文菜单中. (3认同)
  • 你忘了提到如何打开拼写检查,但这些命令一旦打开就会很有用.使用":set spell"将其打开.请注意,如果它是源代码,它足够聪明,只能拼写检查和字符串文字:) (2认同)

小智 6

:setlocal spell spelllang=en_us
:set spell
Run Code Online (Sandbox Code Playgroud)

对于拼写检查器和激活鼠标右键:

:set mousemodel=popup
Run Code Online (Sandbox Code Playgroud)

当您将光标放在单词上并单击右键时,gvim 会使用不同的正确单词。

你可以把它放在你的 ~/.vimrc


Bri*_*per 5

不要:set spell打开拼写检查。请参阅:h spell有关拼写检查如何工作以及如何使用不同语言和词典等的帮助和信息。