[PyKDE] ViM sip syntax file

Jonathan Gardner jgardner at jonathangardner.net
Thu May 29 01:37:01 BST 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wednesday 28 May 2003 15:51, Jonathan Gardner wrote:
> I wrote a syntax file for ViM that include python sections, make
> sections, and highlights the sip function calls. If you use ViM, and you
> want to use the syntax file, just drop it in ~/.vim/syntax/sip.vim or
> $VIM/syntax/sip.vim.
>
> You'll need to add a line to the filetype.vim file to identify *.sip as a
> sip file.

And here's a better version /that actually works/. Sorry for releasing an 
older version!

- -- 
Jonathan Gardner
jgardner at jonathangardner.net
(was jgardn at alumni.washington.edu)
Live Free, Use Linux!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE+1UjoWgwF3QvpWNwRAlUsAJ9Gss8n4+KtRuK9QchJieKC7rNuPgCgtvTd
Hng8uMQn9UrmGDyQG5p89q4=
=ld5x
-----END PGP SIGNATURE-----
-------------- next part --------------
" Vim syntax file
" Language:     sip
" Maintainer:   Jonathan Gardner <jgardner at jonathangardner.net>
" URL:          http://riverbankcomputing.co.uk
" Remark:       
if version < 600
  syntax clear
elseif exists("b:current_syntax")
  finish
endif

runtime! syntax/cpp.vim
unlet b:current_syntax
syn include @Cpp syntax/cpp.vim
unlet b:current_syntax
syn include @Python syntax/python.vim
unlet b:current_syntax
syn include @Make syntax/make.vim
unlet b:current_syntax

syn keyword sipKeyword Version PyMethods PyNumberMethods PySequenceMethods
syn keyword SipKeyword PyMappingMethods
syn keyword SipKeyword __abs__ __add__ __and__ __call__ __cmp__
syn keyword SipKeyword __coerce__ __contains__ __div__ __divmod__
syn keyword SipKeyword __float__ __getitem__ __getslice__ __hash__
syn keyword SipKeyword __hex__ __iadd__ __iand__ __idiv__ __ilshift__
syn keyword SipKeyword __imod__ __imul__ __int__ __invert__ __ior__
syn keyword SipKeyword __ipow__ __irshift__ __isub__ __ixor__ __len__
syn keyword SipKeyword __long__ __lshift__ __mod__ __mul__ __neg__
syn keyword SipKeyword __nonzero__ __oct__ __or__ __pos__ __pow__
syn keyword SipKeyword __repr__ __richcompare__ __rshift__ __setitem__
syn keyword SipKeyword __setslice__ __str__ __sub__ __xor__

syn match sipSpecial "\$[$CSOcomP]"

syn keyword sipConstant sipAcquireLock sipArgs sipArgsParsed sipBadSetType
syn keyword sipConstant sipBadVirtualResultType sipCallHook sipCheckNone
syn keyword sipConstant sipCondAcquireLock sipCondReleaseLock sipConnectRx
syn keyword sipConstant sipConvertFromBool sipConvertFromVoidPtr sipConvertRx
syn keyword sipConstant sipConvertToCpp sipConvertToVoidPtr sipDisconnectRx
syn keyword sipConstant sipEmitSignal sipEvalMethod sipFree sipGetComplexCppPtr
syn keyword sipConstant sipGetCppPtr sipGetRx sipGetThisWrapper
syn keyword sipConstant sipIsSubClassInstance sipMalloc sipMapCppToSelf
syn keyword sipConstant sipParseArgs sipReleaseLock

syn match sipKeyword "^%Module"
syn match sipKeyword "^%End$"
syn match sipKeyword "^%Include"
syn match sipKeyword "^%Import"
syn match sipKeyword "^%Version"
syn match sipKeyword "^%PrimaryVersions"
syn match sipKeyword "^%ExposeFunction$"

syn region sipIf matchgroup=sipKeyword start=+^%If+ end=+^%End$+ contains=TOP fold keepend extend transparent

syn region sipCppCode matchgroup=sipKeyword start="^%\(Member\|C++\|Virtual\|Variable\)Code$" end=+^%End$+ contains=@Cpp,sipSpecial fold keepend extend transparent

syn region sipPythonCode matchgroup=sipKeyword start="^%\(Pre\)\=PythonCode$" end=+^%End$+ contains=@Python,sipSpecial fold keepend extend transparent

syn region sipMakefile matchgroup=sipKeyword start="^%Makefile$" end=+^%End$+ contains=@Make,sipSpecial fold keepend extend transparent

syn region sipHeaderCode matchgroup=sipKeyword start=+^%\(Exported\)\=HeaderCode$+ end=+^%End$+ contains=cInclude,sipKeyword,sipSpecial fold keepend extend transparent

syn region sipCopying matchgroup=sipKeyword start=+^%Copying$+ end=+^%End$+ contains=sipKeyword,sipSpecial fold keepend extend transparent

syn region sipDoc matchgroup=sipKeyword start=+^%\(Exported\)\=Doc$+ end=+^%End$+ contains=sipKeyword,sipSpecial fold keepend extend transparent

syn region sipVersionCode matchgroup=sipKeyword start=+^%VersionCode$+ end=+^%End$+ contains=sipKeyword,sipSpecial fold keepend extend transparent


if version >= 508 || !exists("did_sip_syntax_inits")
  if version < 508
    let did_sip_syntax_inits = 1
    command -nargs=+ HiLink hi link <args>
  else
    command -nargs=+ HiLink hi def link <args>
  endif

  HiLink sipSpecial Special
  HiLink sipKeyword Keyword
  HiLink sipConstant  Constant
  delcommand HiLink
endif

let b:current_syntax = "sip"

" vim: ts=2 sw=2 sts=2 tw=0 et


More information about the PyQt mailing list