This is not a solution, but it is difficult to write / read in the comments.
I meant that I was messing around with syntax / highlighting when I started fixing my own .vimrc , which is why I noticed this. syntax on / syntax enable is only ready to download files (adding a large number of au to BufNewFile / BufRead ). Therefore, if any plugin fiddles with the syntax / highlight settings when writing a file, the file must be loaded again for all the "magic", this is not enough with the installation of filetype . Do :au BufRead , and you will see all the auto commands added at the start of the syntax. But the file must be downloaded to get all the settings.
See this:> syntax-loading
If you do not want to reload the file, try syntax enable , I think this is different from syntax on .
Or try also do :doautocmd filetypedetect BufRead % , see> autocmd-execute
I donβt know what causes the problem, right? Should you add some auto commands or create your own colors / syntax?
Otherwise, until you get a solution, you can try adding autocmd BufWritePost * <with the commands above that works> at the end of your .vimrc , use augroup in this case.
Here is an example:
augroup myResetSyntax au! autocmd BufWritePost * syntax enable | doautocmd filetypedetect BufRead "%" augroup END
244an
source share