Stephan Stephan -4 years ago 84
Python Question

Vim syntax highlighting 'else:' for Python

I'm getting annoyed with the default python syntax highlighting in Vim.

It does not highlight the

statement correctly.
Vim only highlights the else statement if I have some white space between the
and the colon
, so
else :
works, but
does not.

It must be easy to fix.

I'm using Vim 7.2

Answer Source

I had below statement in my vimrc file. This made else: be tokenized as one word. After removing that else: syntax highlighting works just fine.

set iskeyword+=:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download