Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the highlight style in Vim spellcheck?

Right now, when I do :set spell in my Vim, I get spelling errors highlighted as if they are selected text. What I want is an MS-Word like underlining of spelling errors. I tried to lookup :help spell but could not find a clue. Any help is appreciated.

like image 416
Ketan Maheshwari Avatar asked May 15 '11 14:05

Ketan Maheshwari


People also ask

Does vim have spell check?

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.

How do I add spellcheck to Vim?

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 .

How do I invoke the spell check feature review?

Here's how. Click File > Options > Proofing, clear the Check spelling as you type box, and click OK. To turn spell check back on, repeat the process and select the Check spelling as you type box. To check spelling manually, click Review > Spelling & Grammar.


2 Answers

Spelling errors are highlighted using the SpellBad highlighting group. To get it highlighted as you want, you should put something like

hi clear SpellBad hi SpellBad cterm=underline " Set style for gVim hi SpellBad gui=undercurl 

after the last line that is altering the color scheme in your vimrc (it is either set background=(dark|light) or colorscheme {schemename}).

See also :h hl-SpellBad for names and descriptions of other Spell* highlight groups.

like image 106
ZyX Avatar answered Sep 20 '22 12:09

ZyX


The above needs to be typed everytime you set colorscheme. If you wish to avoid it, you should use autocmd.

See https://vi.stackexchange.com/questions/18295/how-to-set-a-colorscheme-that-still-shows-spelling-errors

like image 34
Osamu Aoki Avatar answered Sep 17 '22 12:09

Osamu Aoki