Code Monkey home page Code Monkey logo

Comments (1)

jnurmine avatar jnurmine commented on July 19, 2024

I don't know why Vim behaves like this, but it's not due to any of the color schemes, including Zenburn. I think you also, like me, will see the same behaviour with any color scheme.

A symptom seems to be that when things look OK the pythonInclude highlight group maps to Include highlight group, and when things are broken, there are no highlight groups defined, at all. I suspect something either with Vim internals or with the filetype plugin since the detected syntax is re-set to nothing.

As a quick remedy, you can do :e! to re-load the file, the syntax highlights should re-appear.
Or, you can set syntax=python.

I can sort of kind of reproduce the issue when re-loading a testrc (see below) with :so ~/testrc in a running Vim. Upon :e! things are back to normal, at least for me.

To illustrate how the highlight groups vanish, I did :set nocompatible then this:

map <F10> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>

Then, with the cursor at the "import" in the "import itertools"-line (or "from"-line, just as same) I hit F10 and got:
hi<pythonInclude> trans<pythonInclude> lo<Include>

This means the pythonInclude group maps to Include, which it should.

With the "all white" mode triggered sometimes by re-sourcing the testrc, I just get:
hi<> trans<> lo<>
i.e. the whole syntax was cleared.

I was able to trigger the issue with other colorschemes too.

FYI the minimal .vimrc I used when investigating was:

$ cat testrc
"set nocompatible
set t_Co=256
syntax on
colorscheme zenburn

Then I did: vim -u testrc test.py (with the .py contents as in your example).
The file shows up fine initially for me, though my Vim is a bit earlier version than yours.

from zenburn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.