How to re-enable syntax highlighting in Vim?

Vi and Vim Asked on January 1, 2022

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!

One Answer

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.

Answered by Eli on January 1, 2022

Add your own answers!

Related Questions

Inconsistent behavior from map

1  Asked on August 31, 2021 by stevied


Persistent tag highlights when changing between buffers

1  Asked on August 31, 2021 by vjekoslav


Use normal command output as variable

1  Asked on August 31, 2021 by hassek


Gvim throws the error ‘E285: Failed to create input context’

1  Asked on August 31, 2021 by vladislavthepoker69


How to add a breakpoint into vim

0  Asked on February 18, 2021


Disable mapping of `Man`

0  Asked on February 8, 2021 by tornaxo7


Convert sed regex to vim regex

3  Asked on February 6, 2021


Automatically close oldest buffers?

3  Asked on February 1, 2021 by truejournals


Ask a Question

Get help from others!

© 2023 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP