Sometimes I do not want to add words to a spellfile, but still ignore them this once. This is particularly prevalent when I write markdown.

It would be nice if I could tag a line with <!-- nospell --> (akin to telling a linter to ignore that line) to have it be ignored by the spell checker.

I suspect the answer will have something to do with @NoSpell and .vim/after/syntax/markdown.vim but I'm not familiar enough with syntax highlighting to compose this myself.

PS: I use plasticboy/vim-markdown plugin, but I don't think this should matter.

1 Answer 1


Your suspicions are correct!

Try adding the following to .vim/after/syntax/markdown.vim

syntax match notspellchecked /.*<!-- nospell -->.*/ contains=@NoSpell containedin=ALL

In case you're not already aware of it, you might also be interested in the zG command. This will ignore a misspelled word for the duration of your session. It will be ignored everywhere (so not as precise as your tag), but not forever like if you added it with zg, so it might work for you depending on your requirements.

  • Correction (I had a dangling * that messed up the highlighting previously): Issue1: It wipes out other highlighting. Issue2: it only works within lists (outside lists the mkdNonListItemBlock highlighting is in effect and there is no effect of adding nospell).
    – Patrick
    Aug 18 at 10:53
  • 1
    @Patrick Sorry: insufficient testing on my part. Please try the edited version which should fix issue2.
    – Rich
    Aug 18 at 16:56
  • 1
    @Patrick issue1 is a bit trickier than I was thinking. Still looking for a non-messy solution.
    – Rich
    Aug 18 at 23:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.