wxLua的接口文件扩展名是.i, 如果用gvim编辑会和其实的文件类型语法高这冲突. 为此建议把.i文件和xxxoverride.hpp的文件都改成.wli扩展名, 以下是wli的语法高亮, 初步调试在gvim7.3上可用. " Vim syntax file " Language: wli " Maintainer: loon.x <wunoman@qq.com> " Last Change: 2011 May 30 " Remark: Includ the C++ syntax. " Help: add line following to filetype.vim " au BufNewFile,BufRead *.wli setf wli " For version 5.x: Clear all syntax items. " For version 6.x: Quit when a syntax file was already loaded. if version < 600 syntax clear elseif exists("b:current_syntax") finish endif "embbed C/C++ syntax as cluster @wlicpp but not "runtime! syntax/cpp.vim " include C/C++ syntax syntax include @wlicpp <sfile>:p:h/cpp.vim unlet b:current_syntax syntax case match "setlocal iskeyword+=% " keepend is need because +$+ end of region would eat the ^ " comment for TOP syntax syntax region wlicomment start=+/s*//+ end=+$+ keepend syntax region wlicomment start=+//*+ end=+/*/+ keepend " %define keyword syntax match wlidefine +^/s*%define/s+ contains=wlidefine_key nextgroup=wlidefine_const skipwhite syntax match wlidefine_key contained +^/s*%define+ syntax match wlidefine_const contained +[_A-Za-z][_0-9A-Za-z]*+ nextgroup=@wlicpp skipwhite " %rename keyword syntax match wlirename contained +^/s*%rename/s/+[_A-Za-z][_0-9A-Za-z]/+/>+ contains=wlirename_key syntax match wlirename_key contained +^/s*%rename/>+ nextgroup=wlirename_newname skipwhite syntax match wlirename_newname contained +[_A-Za-z][_0-9A-Za-z]/+/>+ " %oerride %end keyword syntax region wlioverride start=+%override/s+ end=+%end+ keepend contains=wlioverride_start,wlioverride_end,@wlicpp syntax match wlioverride_start contained +%override+ nextgroup=wlioverride_function_name skipwhite syntax match wlioverride_end contained +%end+ syntax match wlioverride_function_name contained +wxLua_[_0-9A-Za-z]/++ nextgroup=wlicomment skipwhite " %class %endclass keyword syntax region wliclass start=+%class/s+ end=+%endclass+ keepend contains=wliclass_start,wlirename,wliclass_end,@wlicpp syntax match wliclass_start contained +%class+ nextgroup=@wliclass_flags skipwhite syntax match wliclass_end contained +%endclass+ syntax cluster wliclass_flags contains=wliclass_flag,wliclass_name,wliclassdesc syntax region wliclassdesc contained start=+//*+ end=+/*/+ keepend nextgroup=@wliclass_flags skipwhite syntax match wliclass_flag contained +%/(member_function/|gc/|delete/|noclassinfo/|encapsulate/|function/)/>+ nextgroup=@wliclass_flags skipwhite syntax match wliclass_name contained +[_A-Za-z][_0-9A-Za-z]*+ nextgroup=wlicomment skipwhite " %enum %endenum keyword syntax cluster wlienum_flags contains=wlienumdesc,wlienum_name syntax region wlienumdesc contained start=+//*+ end=+/*/+ keepend nextgroup=@wlienum_flags skipwhite syntax region wlienum start=+%enum/s+ end=+%endenum+ keepend contains=wlienum_start,wlienum_value,wlienum_end,@wlicpp syntax match wlienum_start contained +%enum/s+ nextgroup=@wlienum_flags skipwhite syntax match wlienum_name contained +[_A-Za-z][_0-9A-Za-z]*+ nextgroup=wlicomment skipwhite syntax match wlienum_end contained +%endenum+ " %function %gc keyword syntax match wlifunc +%function/s./+$+ contains=wlifunc_key,@wlicpp syntax match wlifunc_key contained +%function/s+ nextgroup=wlifunc_gc skipwhite syntax match wlifunc_gc contained +%gc/>+ highlight def link wlicomment Comment highlight def link wliclassdesc Comment highlight def link wlienumdesc Comment highlight def link wliclass_flag wlimodifier highlight def link wlirename_key wlikey highlight def link wlirename_newname wliluatext highlight def link wlioverride_start wlikey highlight def link wlioverride_end wlikey highlight def link wlioverride_function_name wliluatext highlight def link wliclass_start wlikey highlight def link wliclass_end wlikey highlight def link wliclass_name wliluatext highlight def link wlidefine_key wlikey highlight def link wlidefine_const wliluatext highlight def link wlienum_start wlikey highlight def link wlienum_end wlikey highlight def link wlienum_name wliluatext highlight def link wlifunc_key wlikey highlight def link wlifunc_gc wlimodifier highlight def link wlimodifier Operator highlight def link wlikey PreProc highlight def link wliluatext String highlight def link wlicomment Comment let b:current_syntax = "wli"