Vim 'else:' syntax highlighting for Python

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

It does not select the operator else:correctly. Vim only emphasizes the else statement if I have a space between elseand the colon :, so it else :works, but it else:doesn't work.

This should be an easy fix.

I am using Vim 7.2

+5
source share
6 answers

In my vimrc file, I had an expression. It did differently: to be designated as one word. After removing this one more: syntax highlighting works fine.

set iskeyword+=:

+6
source

It should work by default.

, :

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

, :

syn keyword pythonConditional   if elif else

, . elif?

+4

,

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

- .

http://www.vim.org/scripts/script.php?script_id=790

+4

, vimrc:

" No seriously, else: is the same as else
autocmd BufEnter,BufRead,BufNewFile *.py    set iskeyword-=:
+3
+1

~/.vim/syntax/python.vim

syn keyword pythonConditional   else:

.

0

All Articles