Alex Rivera | Logout

Vim syntax highlighting 'else:' for Python

Asked 2009-09-08T09:58:00.670
9

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

Edit
Report

2 Answers

10

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 2009-09-11T12:51:30.553
4

Note that the file in

/usr/share/vim/vim72/syntax/python.vim

is not up to date for some reason.

Get the most recent version of the syntax highlight file from http://www.vim.org/scripts/script.php?script_id=790

answered 2010-10-28T10:31:23.540

Your Answer