📄 idl.vim
字号:
" Vim syntax file" Language: IDL (Interface Description Language)" Maintainer: Jody Goldberg <jgoldberg@home.com>" Last Change: 2001 May 09" This is an experiment. IDL's structure is simple enough to permit a full" grammar based approach to rather than using a few heuristics. The result" is large and somewhat repetative but seems to work." For version 5.x: Clear all syntax items" For version 6.x: Quit when a syntax file was already loadedif version < 600 syntax clearelseif exists("b:current_syntax") finishendif" Misc basicsyn match idlId contained "[a-zA-Z][a-zA-Z0-9_]*"syn match idlSemiColon contained ";"syn match idlCommaArg contained "," skipempty skipwhite nextgroup=idlSimpDeclsyn region idlArraySize1 contained start=:\[: end=:\]: skipempty skipwhite nextgroup=idlArraySize1,idlSemiColon,idlCommaArg contains=idlArraySize1,idlLiteralsyn match idlSimpDecl contained "[a-zA-Z][a-zA-Z0-9_]*" skipempty skipwhite nextgroup=idlSemiColon,idlCommaArg,idlArraySize1syn region idlSting contained start=+"+ skip=+\\\(\\\\\)*"+ end=+"+syn match idlLiteral contained "[1-9]\d*\(\.\d*\)\="syn match idlLiteral contained "\.\d\+"syn keyword idlLiteral contained TRUE FALSE" Commentssyn keyword idlTodo contained TODO FIXME XXXsyn region idlComment start="/\*" end="\*/" contains=idlTodosyn match idlComment "//.*" contains=idlTodosyn match idlCommentError "\*/"" C style Preprocessorsyn region idlIncluded contained start=+"+ skip=+\\\(\\\\\)*"+ end=+"+syn match idlIncluded contained "<[^>]*>"syn match idlInclude "^[ \t]*#[ \t]*include\>[ \t]*["<]" contains=idlIncluded,idlStringsyn region idlPreCondit start="^[ \t]*#[ \t]*\(if\>\|ifdef\>\|ifndef\>\|elif\>\|else\>\|endif\>\)" skip="\\$" end="$" contains=idlComment,idlCommentErrorsyn region idlDefine start="^[ \t]*#[ \t]*\(define\>\|undef\>\)" skip="\\$" end="$" contains=idlLiteral, idlString" Constantssyn keyword idlConst const skipempty skipwhite nextgroup=idlBaseType,idlBaseTypeInt" Attributesyn keyword idlROAttr readonly skipempty skipwhite nextgroup=idlAttrsyn keyword idlAttr attribute skipempty skipwhite nextgroup=idlBaseTypeInt,idlBaseType" Typessyn region idlD4 contained start="<" end=">" skipempty skipwhite nextgroup=idlSimpDecl contains=idlSeqType,idlBaseTypeInt,idlBaseType,idlLiteralsyn keyword idlSeqType contained sequence skipempty skipwhite nextgroup=idlD4syn keyword idlBaseType contained float double char boolean octet any skipempty skipwhite nextgroup=idlSimpDeclsyn keyword idlBaseTypeInt contained short long skipempty skipwhite nextgroup=idlSimpDeclsyn keyword idlBaseType contained unsigned skipempty skipwhite nextgroup=idlBaseTypeIntsyn region idlD1 contained start="<" end=">" skipempty skipwhite nextgroup=idlSimpDecl contains=idlString,idlLiteralsyn keyword idlBaseType contained string skipempty skipwhite nextgroup=idlD1,idlSimpDeclsyn match idlBaseType contained "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*" skipempty skipwhite nextgroup=idlSimpDecl" Modulessyn region idlModuleContent contained start="{" end="}" skipempty skipwhite nextgroup=idlSemiColon contains=idlUnion,idlStruct,idlEnum,idlInterface,idlComment,idlTypedef,idlConst,idlException,idlModulesyn match idlModuleName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlModuleContent,idlSemiColonsyn keyword idlModule module skipempty skipwhite nextgroup=idlModuleName" Interfacessyn region idlInterfaceContent contained start="{" end="}" skipempty skipwhite nextgroup=idlSemiColon contains=idlUnion,idlStruct,idlEnum,idlComment,idlROAttr,idlAttr,idlOp,idlOneWayOp,idlException,idlConst,idlTypedefsyn match idlInheritFrom2 contained "," skipempty skipwhite nextgroup=idlInheritFromsyn match idlInheritFrom contained "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*" skipempty skipwhite nextgroup=idlInheritFrom2,idlInterfaceContentsyn match idlInherit contained ":" skipempty skipwhite nextgroup=idlInheritFromsyn match idlInterfaceName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlInterfaceContent,idlInherit,idlSemiColonsyn keyword idlInterface interface skipempty skipwhite nextgroup=idlInterfaceName" Raisessyn keyword idlRaises contained raises skipempty skipwhite nextgroup=idlRaises,idlContext,idlSemiColon" Contextsyn keyword idlContext contained context skipempty skipwhite nextgroup=idlRaises,idlContext,idlSemiColon" Operationsyn match idlParmList contained "," skipempty skipwhite nextgroup=idlOpParmssyn region idlArraySize contained start="\[" end="\]" skipempty skipwhite nextgroup=idlArraySize,idlParmList contains=idlArraySize,idlLiteralsyn match idlParmName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlParmList,idlArraySizesyn keyword idlParmInt contained short long skipempty skipwhite nextgroup=idlParmNamesyn keyword idlParmType contained unsigned skipempty skipwhite nextgroup=idlParmIntsyn region idlD3 contained start="<" end=">" skipempty skipwhite nextgroup=idlParmName contains=idlString,idlLiteralsyn keyword idlParmType contained string skipempty skipwhite nextgroup=idlD3,idlParmNamesyn keyword idlParmType contained void float double char boolean octet any skipempty skipwhite nextgroup=idlParmNamesyn match idlParmType contained "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*" skipempty skipwhite nextgroup=idlParmNamesyn keyword idlOpParms contained in out inout skipempty skipwhite nextgroup=idlParmTypesyn region idlOpContents contained start="(" end=")" skipempty skipwhite nextgroup=idlRaises,idlContext,idlSemiColon contains=idlOpParmssyn match idlOpName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlOpContentssyn keyword idlOpInt contained short long skipempty skipwhite nextgroup=idlOpNamesyn region idlD2 contained start="<" end=">" skipempty skipwhite nextgroup=idlOpName contains=idlString,idlLiteralsyn keyword idlOp contained unsigned skipempty skipwhite nextgroup=idlOpIntsyn keyword idlOp contained string skipempty skipwhite nextgroup=idlD2,idlOpNamesyn keyword idlOp contained void float double char boolean octet any skipempty skipwhite nextgroup=idlOpNamesyn match idlOp contained "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*" skipempty skipwhite nextgroup=idlOpNamesyn keyword idlOp contained void skipempty skipwhite nextgroup=idlOpNamesyn keyword idlOneWayOp contained oneway skipempty skipwhite nextgroup=idOp" Enumsyn region idlEnumContents contained start="{" end="}" skipempty skipwhite nextgroup=idlSemiColon, idlSimpDecl contains=idlId,idlCommentsyn match idlEnumName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlEnumContentssyn keyword idlEnum enum skipempty skipwhite nextgroup=idlEnumName" Typedefsyn keyword idlTypedef typedef skipempty skipwhite nextgroup=idlBaseType, idlBaseTypeInt, idlSeqType" Structsyn region idlStructContent contained start="{" end="}" skipempty skipwhite nextgroup=idlSemiColon, idlSimpDecl contains=idlBaseType, idlBaseTypeInt, idlSeqType,idlComment, idlEnum, idlUnionsyn match idlStructName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlStructContentsyn keyword idlStruct struct skipempty skipwhite nextgroup=idlStructName" Exceptionsyn keyword idlException exception skipempty skipwhite nextgroup=idlStructName" Unionsyn match idlColon contained ":" skipempty skipwhite nextgroup=idlCase,idlSeqType,idlBaseType,idlBaseTypeIntsyn region idlCaseLabel contained start="" skip="::" end=":"me=e-1 skipempty skipwhite nextgroup=idlColon contains=idlLiteral,idlStringsyn keyword idlCase contained case skipempty skipwhite nextgroup=idlCaseLabelsyn keyword idlCase contained default skipempty skipwhite nextgroup=idlColonsyn region idlUnionContent contained start="{" end="}" skipempty skipwhite nextgroup=idlSemiColon,idlSimpDecl contains=idlCasesyn region idlSwitchType contained start="(" end=")" skipempty skipwhite nextgroup=idlUnionContentsyn keyword idlUnionSwitch contained switch skipempty skipwhite nextgroup=idlSwitchTypesyn match idlUnionName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlUnionSwitchsyn keyword idlUnion union skipempty skipwhite nextgroup=idlUnionNamesyn sync lines=200" Define the default highlighting." For version 5.7 and earlier: only when not done already" For version 5.8 and later: only when an item doesn't have highlighting yetif version >= 508 || !exists("did_idl_syntax_inits") if version < 508 let did_idl_syntax_inits = 1 command -nargs=+ HiLink hi link <args> else command -nargs=+ HiLink hi def link <args> endif HiLink idlInclude Include HiLink idlPreProc PreProc HiLink idlPreCondit PreCondit HiLink idlDefine Macro HiLink idlIncluded String HiLink idlString String HiLink idlComment Comment HiLink idlTodo Todo HiLink idlLiteral Number HiLink idlModule Keyword HiLink idlInterface Keyword HiLink idlEnum Keyword HiLink idlStruct Keyword HiLink idlUnion Keyword HiLink idlTypedef Keyword HiLink idlException Keyword HiLink idlModuleName Typedef HiLink idlInterfaceName Typedef HiLink idlEnumName Typedef HiLink idlStructName Typedef HiLink idlUnionName Typedef HiLink idlBaseTypeInt idlType HiLink idlBaseType idlType HiLink idlSeqType idlType HiLink idlD1 Paren HiLink idlD2 Paren HiLink idlD3 Paren HiLink idlD4 Paren "HiLink idlArraySize Paren "HiLink idlArraySize1 Paren HiLink idlModuleContent Paren HiLink idlUnionContent Paren HiLink idlStructContent Paren HiLink idlEnumContents Paren HiLink idlInterfaceContent Paren HiLink idlSimpDecl Identifier HiLink idlROAttr StorageClass HiLink idlAttr Keyword HiLink idlConst StorageClass HiLink idlOneWayOp StorageClass HiLink idlOp idlType HiLink idlParmType idlType HiLink idlOpName Function HiLink idlOpParms StorageClass HiLink idlParmName Identifier HiLink idlInheritFrom Identifier HiLink idlId Constant "HiLink idlCase Keyword HiLink idlCaseLabel Constant delcommand HiLinkendiflet b:current_syntax = "idl"" vim: ts=8
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -