Vim syntax highlighting 'else:' for Python

Issue

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

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

It must be easy to fix.

I’m using Vim 7.2

Solution

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+=:

Answered By – Stephan

Answer Checked By – Clifford M. (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.