Vim language highlighting has quit working only for one specific file.

I've been using Vim in WSL (Ubuntu) for several months now without problems. My PC is Windows 10 Professional. Strangely, Vim is no longer highlighting properly when I open a particular file.

Everything works fine with every other file, but if I open this one file, it does not display correctly. The syntax highlighting is gone. Line numbers, tabs, and end-of-file-tildes still follow the color scheme, but my actual code is simply colored white. Does anyone know how to fix this?

More details:

  • The file type is *.v
  • If I rename the file, it displays correctly.
  • If multiple files are open at once (i.e. split view), every other file displays fine while this one file does not.
  • The problem arose in the middle of a work session, and I changed nothing in the vimrc before the problem arose.
  • After seeing the problem, I ran apt-get update and apt-get upgrade, followed by a restart.
  • I tried changing the color scheme in my vimrc.

Nothing I tried worked. Any ideas or insight would be greatly appreciated. Thanks!

  • 1
    Welcome to Vi and Vim! It could be something odd saved in a view or a session file; have you tried vim --clean -c 'syntax enable'?
    – D. Ben Knoble
    Jul 24, 2020 at 18:11
  • When you have the *.v file loaded, what does :verbose set ft? return? Does it help if you set 'filetype' to a value that matches the language in the file (such as :set filetype=v or whatever might be the name of the language?)
    – filbranden
    Jul 25, 2020 at 0:57
  • I'm guessing Verilog? :set ft=verilog does that fix it?
    – filbranden
    Jul 25, 2020 at 0:58

1 Answer 1


Thanks for all the suggestions!

I found a bunch of files under ~/.vim/view/ which seemed to provide file-specific configurations for all my source files. So I deleted the one that linked to my problematic Verilog file. It regenerated when I reopened the source file in Vim. Everything displays correctly now. The problem must have been that an auto-generated config file got corrupted somehow.

  • 1
    Indeed, you may have an autocommand that saves views and loads them—I’ve found this causes most people problems in the long run. You might be interested in viewoptions though
    – D. Ben Knoble
    Jul 26, 2020 at 13:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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