aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authortemporal <temporal@630680e5-0e50-0410-840e-4b1c322b438d>2008-07-10 02:12:20 +0000
committertemporal <temporal@630680e5-0e50-0410-840e-4b1c322b438d>2008-07-10 02:12:20 +0000
commit40ee551715c3a784ea6132dbf604b0e665ca2def (patch)
tree6e3ea9674be5b0f59106f88f3afa1313854beebf /editors
downloadprotobuf-40ee551715c3a784ea6132dbf604b0e665ca2def.tar.gz
protobuf-40ee551715c3a784ea6132dbf604b0e665ca2def.tar.bz2
protobuf-40ee551715c3a784ea6132dbf604b0e665ca2def.zip
Initial checkin.
Diffstat (limited to 'editors')
-rw-r--r--editors/README.txt5
-rw-r--r--editors/proto.vim83
2 files changed, 88 insertions, 0 deletions
diff --git a/editors/README.txt b/editors/README.txt
new file mode 100644
index 00000000..3e9fc79e
--- /dev/null
+++ b/editors/README.txt
@@ -0,0 +1,5 @@
+This directory contains syntax highlighting and configuration files for editors
+to properly display Protocol Buffer files.
+
+See each file's header comment for directions on how to use it with the
+appropriate editor.
diff --git a/editors/proto.vim b/editors/proto.vim
new file mode 100644
index 00000000..ea010480
--- /dev/null
+++ b/editors/proto.vim
@@ -0,0 +1,83 @@
+" Protocol Buffers - Google's data interchange format
+" Copyright 2008 Google Inc.
+"
+" Licensed under the Apache License, Version 2.0 (the "License");
+" you may not use this file except in compliance with the License.
+" You may obtain a copy of the License at
+"
+" http:"www.apache.org/licenses/LICENSE-2.0
+"
+" Unless required by applicable law or agreed to in writing, software
+" distributed under the License is distributed on an "AS IS" BASIS,
+" WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+" See the License for the specific language governing permissions and
+" limitations under the License.
+
+" 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
+
+if version < 600
+ syntax clear
+elseif exists("b:current_syntax")
+ finish
+endif
+
+syn case match
+
+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 match pbComment /\/\/.*$/
+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 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"