vim highlighting everything in red

2024/10/18 12:58:08

I added a print line to a python script while the script was executing, and now all the text is highlighted in red when I open the file. Opening and closing the file doesn't get rid of it. Opening a second python file momentarily fixed the problem, but then closing file and reopening brought the problem back. Now it wont go away at all. Any body know what could cause this?

Answer

This happens sometimes in vim when it goes to highlight syntax on multi-line comments. Occasionally everything after the multi-line comment also becomes colored the same as the comment.

I am unsure whether this is a legit bug in vim, or in the actual syntax settings for Python (e.g. python.vim), but I definitely experience this from time-to-time.

https://en.xdnf.cn/q/73308.html

Related Q&A

Using python modules in node.js

Is it possible to create a glue that makes it possible for python modules (more specifically, library bindings) to be used in node.js? Some of the data structures can be directly mapped to V8 objects …

Using PHP to call Virtualenv’ed Python Script

Last night I spent 5.5 hours trying make PHP execute and receive the output of Virtualenv’ed Python script. Nothing worked; except for scripts that were not Virtualenv’ed.What I am trying to do:I am …

How do I find my program name?

ProblemI am unable to write to a different log than the default one using syslog. I am unsure if maybe my app name is wrong in my configuration. Do "program name" and "process name"…

Is it possible to automate the execution of a Python script using Microsoft Flow?

I want to execute a snippet of python code based on some trigger using Microsoft-Flow. Is there a way to do this? Basically I am exploring on Powerapps and Microsoft-Flow. I have data in powerapp, I c…

Python: Selecting numbers with associated probabilities [duplicate]

This question already has answers here:Closed 13 years ago.Possible Duplicates:Random weighted choiceGenerate random numbers with a given (numerical) distribution I have a list of list which contains …

Weights and Biases: Login and network errors

I recently installed Weights and Biases (wandb) for recording the metrics of my machine learning projects. Everything worked fine when connected to wandb cloud instance or when I used a local docker im…

Python: Opening a file without creating a lock

Im trying to create a script in Python to back up some files. But, these files could be renamed or deleted at any time. I dont want my script to prevent that by locking the file; the file should be abl…

Tensorflow dataset questions about .shuffle, .batch and .repeat

I had a question about the use of batch, repeat and shuffle with tf.Dataset.It is not clear to me exactly how repeat and shuffle are used. I understand that .batch will dictate how many training exampl…

How to sort in python with multiple conditions?

I have a list with sublists as follows:result = [ [helo, 10], [bye, 50], [yeah, 5], [candy,30] ]I want to sort this with three conditions: first, by highrest integer in index 2 of sublist, then by leng…

Not able to convert Numpy array to OpenCV Mat in Cython when trying to write c++ wrapper function

I am trying to implement cv::cuda::warpPerspective in python2, there is a very sweet post about how to do that here: link. I followed the instruction as described in that post, however, I got Segmentat…