[Assorted-commits] SF.net SVN: assorted:[1089] configs/trunk/src/vim
Brought to you by:
yangzhang
From: <yan...@us...> - 2008-12-03 18:52:46
|
Revision: 1089 http://assorted.svn.sourceforge.net/assorted/?rev=1089&view=rev Author: yangzhang Date: 2008-12-03 18:52:39 +0000 (Wed, 03 Dec 2008) Log Message: ----------- added syntax files: thrift, proto, pandoc, javafx Modified Paths: -------------- configs/trunk/src/vim/plugin/_yang.vim Added Paths: ----------- configs/trunk/src/vim/ftplugin/proto.vim configs/trunk/src/vim/syntax/fx.vim configs/trunk/src/vim/syntax/pdc.vim configs/trunk/src/vim/syntax/proto.vim configs/trunk/src/vim/syntax/thrift.vim Added: configs/trunk/src/vim/ftplugin/proto.vim =================================================================== --- configs/trunk/src/vim/ftplugin/proto.vim (rev 0) +++ configs/trunk/src/vim/ftplugin/proto.vim 2008-12-03 18:52:39 UTC (rev 1089) @@ -0,0 +1,4 @@ +augroup filetype + au BufRead,BufNewFile *.proto setfiletype proto +augroup end + Modified: configs/trunk/src/vim/plugin/_yang.vim =================================================================== --- configs/trunk/src/vim/plugin/_yang.vim 2008-12-03 18:39:47 UTC (rev 1088) +++ configs/trunk/src/vim/plugin/_yang.vim 2008-12-03 18:52:39 UTC (rev 1089) @@ -186,6 +186,12 @@ au BufWritePost *.bin set nomod | endif augroup END +augroup filetype + au BufRead,BufNewFile *.proto setf proto + au BufRead,BufNewFile *.thrift set ft=thrift + au BufRead,BufNewFile *.pandoc setf pdc +augroup end + au BufNewFile,BufRead *.fx setf fx " Java/Eclim "au BufNewFile,BufRead *.java iunmap <tab> Added: configs/trunk/src/vim/syntax/fx.vim =================================================================== --- configs/trunk/src/vim/syntax/fx.vim (rev 0) +++ configs/trunk/src/vim/syntax/fx.vim 2008-12-03 18:52:39 UTC (rev 1089) @@ -0,0 +1,90 @@ +" Vim syntax file +" Language: JavaFX Script +" Maintainer: Yang Zhang <com.gmail@yaaang> +" URL: http://assorted.sf.net/jfx-vim +" Last Change: 2007 Jun 03 + +" Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +syn case match +syn sync minlines=50 + +" most JFX keywords +syn keyword jfxKeyword after as before bind class else extends first for foreach from if in into last new on private protected return select switch super then trigger var where while insert delete +syn keyword jfxImport import nextgroup=scalaFqn skipwhite +syn match jfxFqn "\<[._$a-zA-Z0-9,*]*" contained nextgroup=jfxFqnSet + +" booleans +syn keyword jfxBoolean true false + +" null +syn keyword jfxNull null + +" package and import statements +syn keyword jfxPackage package nextgroup=jfxFqn skipwhite +syn keyword jfxImport import nextgroup=jfxFqn skipwhite +syn match jfxFqn "\<[._$a-zA-Z0-9,]*" contained + +"" type declarations in val/var/def +syn match jfxType ":\s*[._$a-zA-Z0-9]\+[+*?]\?" contained +":\s*\(=>\s*\)\?[._$a-zA-Z0-9]\+\(\[[^]]*\]\+\)\?\(\s*\(<:\|>:\|#\|=>\)\s*[._$a-zA-Z0-9]\+\(\[[^]]*\]\+\)*\)*"ms=s+1 contained + +" definitions +syn keyword jfxDef function operation nextgroup=jfxDefName skipwhite +syn keyword jfxVar var nextgroup=jfxVarName skipwhite +syn keyword jfxClass class nextgroup=jfxClassName skipwhite +syn keyword jfxAttribute attribute nextgroup=jfxAttributeName skipwhite +syn match jfxAttributeName "[^ =:;([]\+" contained nextgroup=jfxType skipwhite +syn match jfxDefName "[^ =:;([]\+" contained nextgroup=jfxDefArgs nextgroup=jfxType skipwhite +syn match jfxVarName "[^ =:;([]\+" contained nextgroup=jfxType skipwhite +syn match jfxClassName "[^ =:;(\[]\+" contained skipwhite +syn region jfxDefArgs start="(" end=")" contained contains=jfxDefArg skipwhite +" TODO fixme +"syn match jfxDefArg "[^ =:;([]\+" contained nextgroup=jfxType skipwhite + +" comments +syn match jfxTodo "[tT][oO][dD][oO]\|[xX][xX][xX]" contained +syn match jfxLineComment "//.*" contains=jfxTodo +syn region jfxComment start="/\*" end="\*/" contains=jfxTodo + +" string literals with escapes +syn region jfxString start="\"" skip="\\\"" end="\"" contains=jfxStringEscape " TODO end \n or not? +syn match jfxStringEscape "\\u[0-9a-fA-F]\{4}" contained +syn match jfxStringEscape "\\[nrfvb\\\"]" contained +syn match jfxString "'[_a-zA-Z][_a-zA-Z0-9]*\>" +syn match jfxString "'[^'\\]'\|'\\.'" + +" number literals +syn match jfxNumber "\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=\>" +syn match jfxNumber "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[fFdD]\=" +syn match jfxNumber "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>" +syn match jfxNumber "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>" + +syn sync fromstart + +hi link jfxAttribute StorageClass +hi link jfxKeyword Keyword +hi link jfxPackage Include +hi link jfxImport Include +hi link jfxBoolean Boolean +hi link jfxNull Constant +hi link jfxNumber Number +hi link jfxString String +hi link jfxStringEscape Special +hi link jfxComment Comment +hi link jfxLineComment Comment +hi link jfxTodo Todo +hi link jfxDef Keyword +hi link jfxVar Keyword +hi link jfxClass Keyword +hi link jfxDefName Function +hi link jfxDefSpecializer Function +hi link jfxClassName Special +hi link jfxType Type + +let b:current_syntax = "jfx" Added: configs/trunk/src/vim/syntax/pdc.vim =================================================================== --- configs/trunk/src/vim/syntax/pdc.vim (rev 0) +++ configs/trunk/src/vim/syntax/pdc.vim 2008-12-03 18:52:39 UTC (rev 1089) @@ -0,0 +1,330 @@ +" Vim syntax file +" Language: Pandoc (superset of Markdown) +" Maintainer: Jeremy Schultz <ta...@gm...> +" URL: +" Version: 2 +" Changes: 2008-11-04 +" - Fixed an issue with Block elements (header) not being highlighted when +" placed on the first or second line of the file +" - Fixed multi line HTML comment block +" - Fixed lowercase list items +" - Fixed list items gobbling to many empty lines +" - Added highlight support to identify newline (2 spaces) +" - Fixed HTML highlight, ignore if the first character in the +" angle brackets is not a letter +" - Fixed Emphasis highlighting when it contained multiple +" spaces +" Remark: Uses HTML and TeX syntax file + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +syn spell toplevel +syn case ignore +syn sync linebreaks=1 + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Set embedded HTML highlighting +syn include @HTML syntax/html.vim +syn match pdcHTML /<\a[^>]\+>/ contains=@HTML + +" Support HTML multi line comments +syn region pdcHTMLComment start=/<!--/ end=/-->/ + + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Set embedded LaTex (pandox extension) highlighting +" Unset current_syntax so the 2nd include will work +unlet b:current_syntax +syn include @LATEX syntax/tex.vim + +" Single Tex command +syn match pdcLatex /\\\w\+{[^}]\+}/ contains=@LATEX + +" Tex Block (begin-end) +syn region pdcLatex start=/\\begin{[^}]\+}\ze/ end=/\ze\\end{[^}]\+}/ contains=@LATEX + +" Math Tex +syn match pdcLatex /$[^$]\+\$/ contains=@LATEX + + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Block Elements +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +" Needed by other elements +syn match pdcBlankLine /\(^\s*\n\|\%^\)/ nextgroup=pdcHeader,pdcCodeBlock,pdcListItem,pdcListItem1,pdcHRule,pdcTableHeader,pdcTableMultiStart,pdcBlockquote transparent + + +""""""""""""""""""""""""""""""""""""""" +" Title Block: +syn match pandocTitleBlock /\%^\(%.*\n\)\{1,3}$/ + + +""""""""""""""""""""""""""""""""""""""" +" Headers: + +" Underlined, using == or -- +syn match pdcHeader /^.\+\n[=-]\+$/ contains=@Spell nextgroup=pdcHeader contained skipnl + +" Atx-style, Hash marks +syn region pdcHeader start="^\s*#\{1,6}[^#]*" end="\($\|#\+\)" contains=@Spell contained nextgroup=pdcHeader skipnl + + +""""""""""""""""""""""""""""""""""""""" +" Blockquotes: + +syn match pdcBlockquote /\s*>.*$/ nextgroup=pdcBlockquote,pdcBlockquote2 contained skipnl +syn match pdcBlockquote2 /[^>].*/ nextgroup=pdcBlockquote2 skipnl contained + + +""""""""""""""""""""""""""""""""""""""" +" Code Blocks: + +" Indent with at least 4 space or 1 tab +" This rule must appear for pdcListItem, or highlighting gets messed up +syn match pdcCodeBlock /\(\s\{2,}\|\t\{1,}\).*\n/ contained nextgroup=pdcCodeBlock + +" HTML code blocks, pre and code +syn match pdcCodeStartPre /<pre>/ nextgroup=pdcCodeHTMLPre skipnl transparent +syn match pdcCodeHTMLPre /.*/ contained nextgroup=pdcCodeHTMLPre,pdcCodeEndPre skipnl +syn match pdcCodeEndPre /\s*<\/pre>/ contained transparent + +" HTML code blocks, code +syn match pdcCodeStartCode /<code>/ nextgroup=pdcCodeHTMLCode skipnl transparent +syn match pdcCodeHTMLCode /.*/ contained nextgroup=pdcCodeHTMLCode,pdcCodeEndCode skipnl +syn match pdcCodeEndCode /\s*<\/code>/ contained transparent + + +""""""""""""""""""""""""""""""""""""""" +" Lists: + +" These first two rules need to be first or the highlighting will be +" incorrect + +" Continue a list on the next line +syn match pdcListCont /\s*[^-+*].*\n/ contained nextgroup=pdcListCont,pdcListItem,pdcListSkipNL transparent + +" Skip empty lines +syn match pdcListSkipNL /\s*\n/ contained nextgroup=pdcListItem,pdcListSkipNL + +" Unorder list +syn match pdcListItem /\s*[-*+]\s\+/ contained nextgroup=pdcListSkipNL,pdcListCont skipnl + +" Order list, numeric +syn match pdcListItem /\s*(\?\(\d\+\|#\)[\.)]\s\+/ contained nextgroup=pdcListSkipNL,pdcListCont skipnl + +" Order list, roman numerals (does not guarantee correct roman numerals) +syn match pdcListItem /\s*(\?[ivxlcdm]\+[\.)]\s\+/ contained nextgroup=pdcListSkipNL,pdcListCont skipnl + +" Order list, lowercase letters +syn match pdcListItem /\s*(\?\l[\.)]\s\+/ contained nextgroup=pdcListSkipNL,pdcListCont skipnl + +" Order list, uppercase letters, does not include '.' +syn match pdcListItem /\s*(\?\u[\)]\s\+/ contained nextgroup=pdcListSkipNL,pdcListCont skipnl + +" Order list, uppercase letters, special case using '.' and two or more spaces +syn match pdcListItem /\s*\u\.\([ ]\{2,}\|\t\+\)/ contained nextgroup=pdcListSkipNL,pdcListCont skipnl + + +""""""""""""""""""""""""""""""""""""""" +" Horizontal Rules: + +" 3 or more * on a line +syn match pdcHRule /\s\{0,3}\(-\s*\)\{3,}\n/ contained nextgroup=pdcHRule + +" 3 or more - on a line +syn match pdcHRule /\s\{0,3}\(\*\s*\)\{3,}\n/ contained nextgroup=pdcHRule + + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Span Elements +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +""""""""""""""""""""""""""""""""""""""" +" Links: + +" Link Text +syn match pdcLinkText /\[\zs[^\]]*\ze\]/ contains=@Spell + +" Link ID +syn match pdcLinkID /\][ ]\{0,1}\[\zs[^\]]*\ze\]/ + +" Skip [ so we do not highlight it +syn match pdcSkip /^[ ]\{0,3}\[/ nextgroup=pdcLinkID + +" Link ID - definition +syn match pdcLinkID /[^\]]*\ze\]:/ nextgroup=pdcSkip skipwhite contained + +" Skip ]: so we do not highlight it +syn match pdcSkip /\]:/ contained nextgroup=pdcLinkURL skipwhite + +" Link URL +syn region pdcLinkURL start=/\](\zs/ end=/)/me=e-1 + +" Link URL on ID definition line +syn match pdcLinkURL /\s\+.*\s\+\ze[("']/ nextgroup=pdcLinkTitle skipwhite contained +syn match pdcLinkURL /\s*.*\s*[^)"']\s*$/ contained +syn match pdcLinkURL /\s*.*\s*[^)"']\s*\n\s*\ze[("']/ contained nextgroup=pdcLinkTitle skipwhite + +" Link URL for inline <> links +syn match pdcLinkURL /<http[^>]*>/ +syn match pdcLinkURL /<[^>]*@[^>]*.[^>]*>/ + +" Link Title +syn match pdcLinkTitle /\s*[("'].*[)"']/ contained contains=@Spell + + +""""""""""""""""""""""""""""""""""""""" +" Emphasis: + +" Using underscores +syn match pdcEmphasis / \(_\|__\)\([^_ ]\|[^_]\( [^_]\)\+\)\+\1/ contains=@Spell + +" Using Asterisks +syn match pdcEmphasis / \(\*\|\*\*\)\([^\* ]\|[^\*]\( [^\*]\)\+\)\+\1/ contains=@Spell + + +""""""""""""""""""""""""""""""""""""""" +" Inline Code: + +" Using single back ticks +syn region pdcCode start=/`/ end=/`\|^\s*$/ + +" Using double back ticks +syn region pdcCode start=/``[^`]*/ end=/``\|^\s*$/ + + +""""""""""""""""""""""""""""""""""""""" +" Images: +" Handled by link syntax + + +""""""""""""""""""""""""""""""""""""""" +" Misc: + +" Pandoc escapes all characters after a backslash +syn match NONE /\\\W/ + + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Span Elements +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +""""""""""""""""""""""""""""""""""""""" +" Subscripts: +syn match pdcSubscript /\~\([^\~\\ ]\|\(\\ \)\)\+\~/ contains=@Spell + +""""""""""""""""""""""""""""""""""""""" +" Superscript: +syn match pdcSuperscript /\^\([^\^\\ ]\|\(\\ \)\)\+\^/ contains=@Spell + +""""""""""""""""""""""""""""""""""""""" +" Strikeout: +syn match pdcStrikeout /\~\~[^\~ ]\([^\~]\|\~ \)*\~\~/ contains=@Spell + + +""""""""""""""""""""""""""""""""""""""" +" Definitions: +syn match pdcDefinitions /:\(\t\|[ ]\{3,}\)/ nextgroup=pdcListItem,pdcCodeBlock,pdcBlockquote,pdcHRule + +""""""""""""""""""""""""""""""""""""""" +" Footnote: +syn match pdcFootnoteID /\[\^[^\]]\+\]/ nextgroup=pdcFootnoteDef + +" This does not work correctly +syn region pdcFootnoteDef start=/:/ end=/^\n\+\(\(\t\+\|[ ]\{4,}\)\S\)\@!/ contained contains=pdcFootnoteDef + +" Inline footnotes +syn region pdcFootnoteDef matchgroup=pdcFootnoteID start=/\^\[/ matchgroup=pdcFootnoteID end=/\]/ + + +""""""""""""""""""""""""""""""""""""""" +" Tables: +" +" Regular Table +syn match pdcTableHeader /\s*\w\+\(\s\+\w\+\)\+\s*\n\s*-\+\(\s\+-\+\)\+\s*\n/ contained nextgroup=pdcTableBody +syn match pdcTableBody /\s*\w\+\(\s\+\w\+\)\+\s*\n/ contained nextgroup=pdcTableBody,pdcTableCaption skipnl +syn match pdcTableCaption /\n\+\s*Table.*\n/ contained nextgroup=pdcTableCaptionCont +syn match pdcTableCaptionCont /\s*\S.\+\n/ contained nextgroup=pdcTableCaptionCont + +" Multi-line Table +syn match pdcTableMultiStart /^\s\{0,3}-\+\s*\n\ze\(\s*\w\+\(\s\+\w\+\)\+\s*\n\)\+\s*-\+\(\s\+-\+\)\+\s*\n/ contained nextgroup=pdcTableMultiHeader +syn match pdcTableMultiEnd /^\s\{0,3}-\+/ contained nextgroup=pdcTableMultiCaption skipnl +syn match pdcTableMultiHeader /\(\s*\w\+\(\s\+\w\+\)\+\s*\n\)\+\s*-\+\(\s\+-\+\)\+\s*\n/ contained nextgroup=pdcTableMultiBody +syn match pdcTableMultiBody /^\(\s\{3,}[^-]\|[^-\s]\).*$/ contained nextgroup=pdcTableMultiBody,pdcTableMultiSkipNL,pdcTableMultiEnd skipnl +syn match pdcTableMultiSkipNL /^\s*\n/ contained nextgroup=pdcTableMultiBody,pdcTableMultiEnd skipnl +syn match pdcTableMultiCaption /\n*\s*Table.*\n/ contained nextgroup=pdcTableCaptionCont + + + +""""""""""""""""""""""""""""""""""""""" +" Delimited Code Block: (added in 1.0) +syn region pdcCodeBlock matchgroup=pdcCodeStart start=/^\z(\~\{3,}\) \( {[^}]\+}\)\?/ matchgroup=pdcCodeEnd end=/^\z1\~*/ + + +""""""""""""""""""""""""""""""""""""""" +" Newline, 2 spaces at the end of line means newline +syn match pdcNewLine / $/ + + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Highlight groups +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +hi link pdcHeader Title +hi link pdcBlockquote Comment +hi link pdcBlockquote2 Comment + +hi link pdcHTMLComment Comment + +hi link pdcHRule Underlined +"hi link pdcHRule Special + +hi link pdcListItem Operator +hi link pdcDefinitions Operator + +hi link pdcEmphasis Special +hi link pdcSubscript Special +hi link pdcSuperscript Special +hi link pdcStrikeout Special + +hi link pdcLinkText Underlined +hi link pdcLinkID Identifier +hi link pdcLinkURL Type +hi link pdcLinkTitle Comment + +hi link pdcFootnoteID Identifier +hi link pdcFootnoteDef Comment +hi link pandocFootnoteCont Error + +hi link pdcCodeBlock String +hi link pdcCodeHTMLPre String +hi link pdcCodeHTMLCode String +hi link pdcCode String +hi link pdcCodeStart Comment +hi link pdcCodeEnd Comment + +hi link pandocTitleBlock Comment + +hi link pdcTableMultiStart Comment +hi link pdcTableMultiEnd Comment +hi link pdcTableHeader Define +hi link pdcTableMultiHeader Define +hi link pdcTableBody Identifier +hi link pdcTableMultiBody Identifier +hi link pdcTableCaption Label +hi link pdcTableMultiCaption Label +hi link pdcTableCaptionCont Label + +hi link pdcNewLine Error + + +" For testing +hi link pdctest Error + + +let b:current_syntax = "pandoc" + Added: configs/trunk/src/vim/syntax/proto.vim =================================================================== --- configs/trunk/src/vim/syntax/proto.vim (rev 0) +++ configs/trunk/src/vim/syntax/proto.vim 2008-12-03 18:52:39 UTC (rev 1089) @@ -0,0 +1,106 @@ +" Protocol Buffers - Google's data interchange format +" Copyright 2008 Google Inc. All rights reserved. +" http://code.google.com/p/protobuf/ +" +" Redistribution and use in source and binary forms, with or without +" modification, are permitted provided that the following conditions are +" met: +" +" * Redistributions of source code must retain the above copyright +" notice, this list of conditions and the following disclaimer. +" * Redistributions in binary form must reproduce the above +" copyright notice, this list of conditions and the following disclaimer +" in the documentation and/or other materials provided with the +" distribution. +" * Neither the name of Google Inc. nor the names of its +" contributors may be used to endorse or promote products derived from +" this software without specific prior written permission. +" +" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +" OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +" This is the Vim syntax file for Google Protocol Buffers. +" +" Usage: +" +" 1. cp proto.vim ~/.vim/syntax/ +" 2. Add the following to ~/.vimrc: +" +" augroup filetype +" au! BufRead,BufNewFile *.proto setfiletype proto +" augroup end +" +" Or just create a new file called ~/.vim/ftdetect/proto.vim with the +" previous lines on it. + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +syn case match + +syn keyword pbTodo contained TODO FIXME XXX +syn cluster pbCommentGrp contains=pbTodo + +syn keyword pbSyntax syntax import option +syn keyword pbStructure package message group +syn keyword pbRepeat optional required repeated +syn keyword pbDefault default +syn keyword pbExtend extend extensions to max +syn keyword pbRPC service rpc returns + +syn keyword pbType int32 int64 uint32 uint64 sint32 sint64 +syn keyword pbType fixed32 fixed64 sfixed32 sfixed64 +syn keyword pbType float double bool string bytes +syn keyword pbTypedef enum +syn keyword pbBool true false + +syn match pbInt /-\?\<\d\+\>/ +syn match pbInt /\<0[xX]\x+\>/ +syn match pbFloat /\<-\?\d*\(\.\d*\)\?/ +" TODO: .proto also supports C-style block comments; +" see /usr/share/vim/vim70/syntax/c.vim for how it's done. +syn region pbComment start="//" skip="\\$" end="$" keepend contains=@pbCommentGrp +syn region pbString start=/"/ skip=/\\"/ end=/"/ +syn region pbString start=/'/ skip=/\\'/ end=/'/ + +if version >= 508 || !exists("did_proto_syn_inits") + if version < 508 + let did_proto_syn_inits = 1 + command -nargs=+ HiLink hi link <args> + else + command -nargs=+ HiLink hi def link <args> + endif + + HiLink pbTodo Todo + + HiLink pbSyntax Include + HiLink pbStructure Structure + HiLink pbRepeat Repeat + HiLink pbDefault Keyword + HiLink pbExtend Keyword + HiLink pbRPC Keyword + HiLink pbType Type + HiLink pbTypedef Typedef + HiLink pbBool Boolean + + HiLink pbInt Number + HiLink pbFloat Float + HiLink pbComment Comment + HiLink pbString String + + delcommand HiLink +endif + +let b:current_syntax = "proto" Added: configs/trunk/src/vim/syntax/thrift.vim =================================================================== --- configs/trunk/src/vim/syntax/thrift.vim (rev 0) +++ configs/trunk/src/vim/syntax/thrift.vim 2008-12-03 18:52:39 UTC (rev 1089) @@ -0,0 +1,74 @@ +" Vim syntax file +" Language: Thrift +" Maintainer: Martin Smith <ma...@fa...> +" Last Change: $Date: $ +" Copy to ~/.vim/ +" Add to ~/.vimrc +" au BufRead,BufNewFile *.thrift set filetype=thrift +" au! Syntax thrift source ~/.vim/thrift.vim +" +" $Id: $ + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +" Todo +syn keyword thriftTodo TODO todo FIXME fixme XXX xxx contained + +" Comments +syn match thriftComment "#.*" contains=thriftTodo +syn region thriftComment start="/\*" end="\*/" contains=thriftTodo +syn match thriftComment "//.\{-}\(?>\|$\)\@=" + +" String +syn region thriftStringDouble matchgroup=None start=+"+ end=+"+ + +" Number +syn match thriftNumber "-\=\<\d\+\>" contained + +" Keywords +syn keyword thriftKeyword namespace +syn keyword thriftKeyword php_namespace +syn keyword thriftKeyword xsd_all xsd_optional xsd_nillable xsd_namespace xsd_attrs +syn keyword thriftKeyword include cpp_include cpp_type const optional required +syn keyword thriftBasicTypes void bool byte i16 i32 i64 double string binary +syn keyword thriftStructure map list set struct typedef exception enum throws + +" Special +syn match thriftSpecial "\d\+:" + +" Structure +syn keyword thriftStructure service async extends +"async" { return tok_async; } +"exception" { return tok_xception; } +"extends" { return tok_extends; } +"throws" { return tok_throws; } +"service" { return tok_service; } +"enum" { return tok_enum; } +"const" { return tok_const; } + +if version >= 508 || !exists("did_thrift_syn_inits") + if version < 508 + let did_thrift_syn_inits = 1 + command! -nargs=+ HiLink hi link <args> + else + command! -nargs=+ HiLink hi def link <args> + endif + + HiLink thriftComment Comment + HiLink thriftKeyword Special + HiLink thriftBasicTypes Type + HiLink thriftStructure StorageClass + HiLink thriftTodo Todo + HiLink thriftString String + HiLink thriftNumber Number + HiLink thriftSpecial Special + HiLink thriftStructure Structure + + delcommand HiLink +endif + +let b:current_syntax = "thrift" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |