I switched from macos to linux and have spontaneous highlighting in my document. I tried to get rid of it by doing the following command without success:

hi clear
no syntax

The randomly highlighted pattern is for example in the following line written in python, the strings numpy and savetxt are highlighted:

#from numpy import savetxt

when I uncomment the the line, the highlighting disapears

from numpy import savetxt

Here is a screenshot of the highlighting:

enter image description here

The highlighting disappeared after inserting in the .vimrc:

set nospell

But but I thin it then anihi

late the command:

set spellang=en
set spell

int the .vimrc

What should I do?

  • 2
    Not sure what you mean by "persisting" or "spontaneous" highlighting. Do you want to turn off syntax highlighting? Everywhere? Try :syntax off. Note that highlighting of search terms is a different animal.
    – B Layer
    Jun 8 at 6:55
  • @BLayer: many thanks for your comment. I also tried :syntax off: this removed the (helpful) syntax highlighting but didn't remove the "random" other bothersome highlighting
    – ecjb
    Jun 8 at 9:13
  • You're welcome. Can you describe in detail what those other highlighting things are and do so in your question? (Hit that "Edit" link.) Before you do see :h 'nohls', though.
    – B Layer
    Jun 8 at 9:27
  • 2
    Could be spelling inside comments
    – D. Ben Knoble
    Jun 8 at 12:52
  • 3
    screenshot would provide a lot of help. Anyway, run :set nospell.
    – Maxim Kim
    Jun 8 at 12:57

Most probably you have set spell enabled which usually checks spelling in comments.

If you don't need it turn it off with :set nospell. Activate when you need it with :set spell.

To toggle use :set spell!.

Map it if you do it often, for example:

nnoremap yos :set spell!<CR>

Then yos will toggle spelling.

  • many thanks for your answer @MaximKim
    – ecjb
    Jun 9 at 15:22

This site is temporarily in read only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .