Spelling errors hidden while highlighting line in vim

1) one could change the vim color scheme, or the SpellBad highlight scheme; one example of the second case is to add in vimrc the following,

hi clear SpellBad
hi SpellBad cterm=bold

2) (not a solution) someone might find 'spell checking while composing' is a bit annoying / distracting and prefer switching the spell checking off until they finish writing the article.


The problem is that the cursorline highlighting has priority over the syntax highlighting (spell errors belong to that), and that cannot be changed. (You can only specify the priority with the newer matchadd() functions.)

I've once raised this issue for error highlighting, but nothing came out of it. (I'd still like to implement a patch for that one day.)

The problem is only about overlap of background highlighting; in GVIM, most color schemes use the undercurl attribute to avoid that issue. In the console, you can only change the highlighting to foreground color, italic or bold attributes to work around it.

workaround

One clever workaround involves swapping the foreground and background colors while adding the reverse attribute: Turn

hi SpellBad cterm=NONE ctermbg=red ctermfg=white

to

hi SpellBad cterm=reverse ctermbg=white ctermfg=red

These two changes cancel each other out normally, but on a CursorLine, the foreground color now contributes to the coloring, turning hard-to-read white-on-cursorline to red-on-cursorline.

Tags:

Vim