I've just started learning python and I'm using MacVim as my editor with the Jellybeans color scheme. When I write a for-loop in python the 'for' is colored blue(ish) while the 'in' is not. I see in other themes they are both colored the same. How do I edit the jellybeans theme to get that?
Here's a picture showing what I mean:
Vim's python syntax file defines in
as part of the pythonOperator
syntax group. The pythonOperator
group is linked to the built-in Operator
group, which is (by default) linked in turn to Statement
.
Jellybeans instead links Operator
to Normal
to get uncolored symbolic operators ( +
, *
, etc) without changing Statement
.
Adding a special case link directly from pythonOperator
to Statement
restores the coloring.
tl;dr I fixed it . Grab a new copy from the GitHub repo .
There are several ways to "accomplish" that. Could you give the link from where you downloaded the aforementioend Jellybeans color scheme?
My first look would be whether in the colorscheme there is something that overwrites the "in" element into a different color than the "for" element. If there is nothing inside, then it must be something with the syntax highlighting for python.
But in that case, that would also show with other color schemes as well.
To change the color of the loops in only python, add this to your .vimrc after you set the color-scheme
autocmd FileType python hi Repeat guifg=#hexnumber
with #hexnumber the gui code for the color you want to change the color of just the operators replace Repeat with operator
edit:
I might have misunderstood your question loops are in the highlight group repeat and in is in the hi-group operator both belong to the group statement so if statement is the only one set in you color-scheme you have to set Repeat and operator yourself
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.