1 " Protocol Buffers - Google's data interchange format
2 " Copyright 2008 Google Inc.
4 " Licensed under the Apache License, Version 2.0 (the "License");
5 " you may not use this file except in compliance with the License.
6 " You may obtain a copy of the License at
8 " http:"www.apache.org/licenses/LICENSE-2.0
10 " Unless required by applicable law or agreed to in writing, software
11 " distributed under the License is distributed on an "AS IS" BASIS,
12 " WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 " See the License for the specific language governing permissions and
14 " limitations under the License.
16 " This is the Vim syntax file for Google Protocol Buffers.
20 " 1. cp proto.vim ~/.vim/syntax/
21 " 2. Add the following to ~/.vimrc:
24 " au! BufRead,BufNewFile *.proto setfiletype proto
27 " Or just create a new file called ~/.vim/ftdetect/proto.vim with the
28 " previous lines on it.
32 elseif exists("b:current_syntax")
38 syn keyword pbTodo contained TODO FIXME XXX
39 syn cluster pbCommentGrp contains=pbTodo
41 syn keyword pbSyntax syntax import option
42 syn keyword pbStructure package message group
43 syn keyword pbRepeat optional required repeated
44 syn keyword pbDefault default
45 syn keyword pbExtend extend extensions to max
46 syn keyword pbRPC service rpc returns
48 syn keyword pbType int32 int64 uint32 uint64 sint32 sint64
49 syn keyword pbType fixed32 fixed64 sfixed32 sfixed64
50 syn keyword pbType float double bool string bytes
51 syn keyword pbTypedef enum
52 syn keyword pbBool true false
54 syn match pbInt /-\?\<\d\+\>/
55 syn match pbInt /\<0[xX]\x+\>/
56 syn match pbFloat /\<-\?\d*\(\.\d*\)\?/
57 " TODO: .proto also supports C-style block comments;
58 " see /usr/share/vim/vim70/syntax/c.vim for how it's done.
59 syn region pbComment start="//" skip="\\$" end="$" keepend contains=@pbCommentGrp
60 syn region pbString start=/"/ skip=/\\"/ end=/"/
61 syn region pbString start=/'/ skip=/\\'/ end=/'/
63 if version >= 508 || !exists("did_proto_syn_inits")
65 let did_proto_syn_inits = 1
66 command -nargs=+ HiLink hi link <args>
68 command -nargs=+ HiLink hi def link <args>
73 HiLink pbSyntax Include
74 HiLink pbStructure Structure
75 HiLink pbRepeat Repeat
76 HiLink pbDefault Keyword
77 HiLink pbExtend Keyword
80 HiLink pbTypedef Typedef
85 HiLink pbComment Comment
86 HiLink pbString String
91 let b:current_syntax = "proto"