如何让 Vim 拼写检查记住一个新单词

And*_*edd 84 vim gvim spell-check

我正在使用 gVim 进行 LaTeX 编辑。我用vim字典不知道的词写了很多科学文档。在进行拼写检查时,我遇到了我知道拼写正确的单词,如何将这些单词添加到词典中?

Dav*_*llo 110

从vim手册:

To add words to your own word list:

zg       Add word under the cursor as a good word to the first
         name in 'spellfile'.  A count may precede the command
         to indicate the entry in 'spellfile' to be used.  A
         count of two uses the second entry.

         In Visual mode the selected characters are added as a
         word (including white space!).
         When the cursor is on text that is marked as badly
         spelled then the marked text is used.
         Otherwise the word under the cursor, separated by
         non-word characters, is used.

         If the word is explicitly marked as bad word in
         another spell file the result is unpredictable.


zG       Like "zg" but add the word to the internal word list
         |internal-wordlist|.


zw       Like "zg" but mark the word as a wrong (bad) word.
         If the word already appears in 'spellfile' it is
         turned into a comment line.  See |spellfile-cleanup|
         for getting rid of those.


zW       Like "zw" but add the word to the internal word list
         |internal-wordlist|.

zuw
zug      Undo |zw| and |zg|, remove the word from the entry in
         'spellfile'.  Count used as with |zg|.

zuW
zuG      Undo |zW| and |zG|, remove the word from the internal
         word list.  Count used as with |zg|.
Run Code Online (Sandbox Code Playgroud)

在命令行上:

:[count]spe[llgood] {word}
         Add {word} as a good word to 'spellfile', like with
         |zg|.  Without count the first name is used, with a
         count of two the second entry, etc.

:spe[llgood]! {word} Add {word} as a good word to the internal word list,
         like with |zG|.


:[count]spellw[rong] {word}
         Add {word} as a wrong (bad) word to 'spellfile', as
         with |zw|.  Without count the first name is used, with
         a count of two the second entry, etc.

:spellw[rong]! {word}   Add {word} as a wrong (bad) word to the internal word
         list, like with |zW|.

:[count]spellu[ndo] {word}
         Like |zuw|.  [count] used as with |:spellgood|.

:spellu[ndo]! {word} Like |zuW|.  [count] used as with |:spellgood|.
Run Code Online (Sandbox Code Playgroud)

有关 vim 中拼写的更多帮助,请键入:help spell:help spell-quickstart

  • 将单词添加到“spellfile”和将其添加到内部单词列表有什么区别? (7认同)
  • @LuísdeSousa“内部单词列表用于所有设置了‘spell’的缓冲区。它不会被存储,当你退出 Vim 时它会丢失。当设置‘encoding’时它也会被清除。” http://vimdoc.sourceforge.net/htmldoc/spell.html#internal-wordlist 与 http://vimdoc.sourceforge.net/htmldoc/options.html#'spellfile' (6认同)
  • `:spellgood!` 用于添加包含空格的单词(例如 `de Bruijn`)。 `:拼写好!de Bruijn` (5认同)