A Python color syntax file for VIM
scott
scott at chronis.pobox.com
Mon Oct 4 03:14:33 EDT 1999
On Mon, Oct 04, 1999 at 12:59:39AM +0000, Neil Schemenauer wrote:
> I don't want to ram my beliefs down everbody's throat though.
> Users of python.vim, please vote:
>
> a) more highlighting
> b) less highlighting
> c) its perfect, don't mess with it
>
> If I get enought votes I will post a summary. I guess emacs (and
I think that different people like different types of highlighting, so
It would probably be best if lots of individual things could be turned
on and off, and some default setting for lots and just a little
highlighting be made.
I don't like a lot of highlighting either, but I did make the
following changes to my python.vim file in order to have printf-like
characters and %(substitute-me)s strings stand out from within
strings. It seems to makes it much clearer what is happening with
strings 99% of the time, and follows vim's c-highlighting lead a bit.
syn match pythonSpecialCharacter "\\['\"?\\abfnrtv]" contained
syn match pythonSpecialCharacter "\\\(0x\)\=[0123456789]\{1,3}" contained
hi link pythonSpecialCharacter pythonFormat
syn match pythonFormat contained "%%"
syn match pythonFormat "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([diuoxXfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
syn match pythonFormat "%([^)]\+)\(\d\+\(\.\d\+\)\=\)\=[sdf]" contained
syn region pythonString start=+'+ end=+'+ skip=+\\\\\|\\'+ contains=pythonFormat,pythonSpecialCharacter
syn region pythonString start=+"+ end=+"+ skip=+\\\\\|\\"+ contains=pythonFormat,pythonSpecialCharacter
syn region pythonString start=+"""+ end=+"""+ contains=pythonFormat,pythonSpecialCharacter
syn region pythonString start=+'''+ end=+'''+ contains=pythonFormat,pythonSpecialCharacter
scott
More information about the Python-list
mailing list