I'd like to turn on spell check to avoid typos in comment, but in code those red underlines are really annoying...
Some file type plugins could do that for other languages, like Python, but I couldn't find any c plugins.
I tried c.vim but it doesn't work.
Using SpellcheckingTo move to a misspelled word, use ]s and [s . The ]s command will move the cursor to the next misspelled word, the [s command will move the cursor back through the buffer to previous misspelled words. Just hit Enter if none of the suggestions work, or enter the number for the correct word.
This is useful when editing text that also has Asian words. We can then press F11 to toggle spell checking.
If you want to turn it on, run setlocal spell in the Vim command line (if you want spell check to always be on, add set spell to your . vimrc). After turning spell check on, misspelled words will now be highlighted. To move your cursor to the next misspelled word, enter ]s .
CSpell, a distributable spell checker for consumer language, is designed to detect and correct various types of spelling errors in Consumer Health Questions.
You should be able to modify the c syntax file to get the behavior you want. When you load a c file (or set a file to c filetype) the c syntax file is loaded from the /vimxx/syntax directory, it's the file there named c.vim. This file has all the various syntax statements that establish elements that can be highlighted.
You will notice several statements throughout the file that end with contains=
and have @Spell
among the groups that are "contained". If you remove @Spell
from these statements (mostly string syntax items) and leave @Spell
in the contains clause for "comment" elements (e.g., cComment
) that should do what you want.
Be careful not to remove @Spell
from any contains=ALLBUT,
clauses, which, as you might guess, list syntax items that may not be contained in the given group.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With