summaryrefslogtreecommitdiff
path: root/syntax
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-02-15 08:52:32 +0000
committerAkshay <[email protected]>2021-02-15 08:52:32 +0000
commitfcaf13a267b7bacd26ad8b2e952a793645e42bba (patch)
tree6e795b46b1fbefb05151e95c0346951d67fac4e7 /syntax
init
Diffstat (limited to 'syntax')
-rw-r--r--syntax/kotlin.vim139
-rw-r--r--syntax/proto.vim106
2 files changed, 245 insertions, 0 deletions
diff --git a/syntax/kotlin.vim b/syntax/kotlin.vim
new file mode 100644
index 0000000..48fc6ce
--- /dev/null
+++ b/syntax/kotlin.vim
@@ -0,0 +1,139 @@
1" Vim syntax file
2" Language: Kotlin
3" Maintainer: Alexander Udalov
4" Latest Revision: 13 July 2020
5
6if exists('b:current_syntax')
7 finish
8endif
9
10syn keyword ktStatement break continue return
11syn keyword ktConditional if else when
12syn keyword ktRepeat do for while
13syn keyword ktOperator in is by
14syn keyword ktKeyword get set out super this where
15syn keyword ktException try catch finally throw
16
17syn keyword ktInclude import package
18
19" The following is generated by generate-stdlib-class-names.main.kts
20syn keyword ktType AbstractCollection AbstractCoroutineContextElement AbstractCoroutineContextKey AbstractDoubleTimeSource AbstractIterator AbstractList AbstractLongTimeSource
21syn keyword ktType AbstractMap AbstractMutableCollection AbstractMutableList AbstractMutableMap AbstractMutableSet AbstractSet AccessDeniedException Accessor Annotation
22syn keyword ktType AnnotationRetention AnnotationTarget Any Appendable ArithmeticException Array ArrayDeque ArrayList AssertionError Boolean BooleanArray BooleanIterator
23syn keyword ktType BuilderInference Byte ByteArray ByteIterator CallsInPlace CancellationException Char CharArray CharCategory CharDirectionality CharIterator CharProgression
24syn keyword ktType CharRange CharSequence CharacterCodingException Charsets ClassCastException Cloneable ClosedFloatingPointRange ClosedRange Collection Comparable Comparator
25syn keyword ktType ConcurrentModificationException ConditionalEffect Continuation ContinuationInterceptor ContractBuilder CoroutineContext DeepRecursiveFunction DeepRecursiveScope
26syn keyword ktType Delegates Deprecated DeprecatedSinceKotlin DeprecationLevel Destructured Double DoubleArray DoubleIterator DslMarker Duration DurationUnit Effect Element
27syn keyword ktType EmptyCoroutineContext Entry Enum Error Exception Experimental ExperimentalContracts ExperimentalJsExport ExperimentalMultiplatform ExperimentalStdlibApi
28syn keyword ktType ExperimentalTime ExperimentalTypeInference ExperimentalUnsignedTypes ExtensionFunctionType FileAlreadyExistsException FileSystemException FileTreeWalk
29syn keyword ktType FileWalkDirection Float FloatArray FloatIterator Function Function0 Function1 Function10 Function11 Function12 Function13 Function14 Function15 Function16
30syn keyword ktType Function17 Function18 Function19 Function2 Function20 Function21 Function22 Function3 Function4 Function5 Function6 Function7 Function8 Function9 FunctionN
31syn keyword ktType Getter Grouping HashMap HashSet IllegalArgumentException IllegalStateException IndexOutOfBoundsException IndexedValue Int IntArray IntIterator IntProgression
32syn keyword ktType IntRange InvocationKind Iterable Iterator JsExport JsName JvmDefault JvmDefaultWithoutCompatibility JvmField JvmMultifileClass JvmName JvmOverloads JvmStatic
33syn keyword ktType JvmSuppressWildcards JvmSynthetic JvmWildcard KAnnotatedElement KCallable KClass KClassifier KDeclarationContainer KFunction KMutableProperty KMutableProperty0
34syn keyword ktType KMutableProperty1 KMutableProperty2 KParameter KProperty KProperty0 KProperty1 KProperty2 KType KTypeParameter KTypeProjection KVariance KVisibility Key Kind
35syn keyword ktType KotlinNullPointerException KotlinReflectionNotSupportedError KotlinVersion Lazy LazyThreadSafetyMode Level LinkedHashMap LinkedHashSet List ListIterator Long
36syn keyword ktType LongArray LongIterator LongProgression LongRange Map MatchGroup MatchGroupCollection MatchNamedGroupCollection MatchResult Metadata Monotonic MustBeDocumented
37syn keyword ktType MutableCollection MutableEntry MutableIterable MutableIterator MutableList MutableListIterator MutableMap MutableSet NoSuchElementException NoSuchFileException
38syn keyword ktType NoWhenBranchMatchedException NotImplementedError Nothing NullPointerException Number NumberFormatException ObservableProperty OnErrorAction OptIn
39syn keyword ktType OptionalExpectation OverloadResolutionByLambdaReturnType Pair ParameterName PropertyDelegateProvider PublishedApi PurelyImplements Random RandomAccess
40syn keyword ktType ReadOnlyProperty ReadWriteProperty Regex RegexOption Repeatable ReplaceWith RequiresOptIn RestrictsSuspension Result Retention Returns ReturnsNotNull
41syn keyword ktType RuntimeException Sequence SequenceScope Set Setter SharedImmutable Short ShortArray ShortIterator SimpleEffect SinceKotlin Strictfp String StringBuilder Suppress
42syn keyword ktType Synchronized Target TestTimeSource ThreadLocal Throwable Throws TimeMark TimeSource TimedValue Transient Triple TypeCastException Typography UByte UByteArray
43syn keyword ktType UByteIterator UInt UIntArray UIntIterator UIntProgression UIntRange ULong ULongArray ULongIterator ULongProgression ULongRange UShort UShortArray UShortIterator
44syn keyword ktType UninitializedPropertyAccessException Unit UnsafeVariance UnsupportedOperationException UseExperimental Volatile
45
46syn keyword ktModifier annotation companion enum inner internal private protected public abstract final open override sealed vararg dynamic expect actual
47syn keyword ktStructure class object interface typealias fun val var constructor init
48
49syn keyword ktReservedKeyword typeof
50
51syn keyword ktBoolean true false
52syn keyword ktConstant null
53
54syn keyword ktModifier data tailrec lateinit reified external inline noinline crossinline const operator infix suspend
55
56syn match ktOperator "\v\?:|::|\<\=? | \>\=?|[!=]\=\=?|<as>\??|[-!%&*+/|]"
57
58syn keyword ktTodo TODO FIXME XXX contained
59syn match ktShebang "\v^#!.*$"
60syn match ktLineComment "\v//.*$" contains=ktTodo,@Spell
61syn region ktComment matchgroup=ktCommentMatchGroup start="/\*" end="\*/" contains=ktComment,ktTodo,@Spell
62
63syn region ktDocComment start="/\*\*" end="\*/" contains=ktDocTag,ktTodo,@Spell
64syn match ktDocTag "\v\@(author|constructor|receiver|return|since|suppress)>" contained
65syn match ktDocTag "\v\@(exception|param|property|throws|see|sample)>\s*\S+" contains=ktDocTagParam contained
66syn match ktDocTagParam "\v(\s|\[)\S+" contained
67syn match ktComment "/\*\*/"
68
69syn match ktSpecialCharError "\v\\." contained
70syn match ktSpecialChar "\v\\([tbnr'"$\\]|u\x{4})" contained
71syn region ktString start='"' skip='\\"' end='"' contains=ktSimpleInterpolation,ktComplexInterpolation,ktSpecialChar,ktSpecialCharError
72syn region ktString start='"""' end='""""*' contains=ktSimpleInterpolation,ktComplexInterpolation
73syn match ktCharacter "\v'[^']*'" contains=ktSpecialChar,ktSpecialCharError
74syn match ktCharacter "\v'\\''" contains=ktSpecialChar
75syn match ktCharacter "\v'[^\\]'"
76
77" TODO: highlight label in 'this@Foo'
78syn match ktAnnotation "\v(\w)@<!\@[[:alnum:]_.]*(:[[:alnum:]_.]*)?"
79syn match ktLabel "\v\w+\@"
80
81syn match ktSimpleInterpolation "\v\$\h\w*" contained
82syn region ktComplexInterpolation matchgroup=ktComplexInterpolationBrace start="\v\$\{" end="\v\}" contains=ALLBUT,ktSimpleInterpolation,ktTodo,ktSpecialCharError,ktSpecialChar,ktDocTag,ktDocTagParam
83
84syn match ktNumber "\v<\d+[_[:digit:]]*(uL?|UL?|[LFf])?"
85syn match ktNumber "\v<0[Xx]\x+[_[:xdigit:]]*(uL?|UL?|L)?"
86syn match ktNumber "\v<0[Bb][01]+[_01]*(uL?|UL?|L)?"
87syn match ktFloat "\v<\d*(\d[eE][-+]?\d+|\.\d+([eE][-+]?\d+)?)[Ff]?"
88
89syn match ktEscapedName "\v`.*`"
90
91syn match ktExclExcl "!!"
92syn match ktArrow "->"
93
94hi def link ktStatement Statement
95hi def link ktConditional Conditional
96hi def link ktRepeat Repeat
97hi def link ktOperator Operator
98hi def link ktKeyword Keyword
99hi def link ktException Exception
100hi def link ktReservedKeyword Error
101
102hi def link ktInclude Include
103
104hi def link ktType Type
105hi def link ktModifier StorageClass
106hi def link ktStructure Structure
107hi def link ktTypedef Typedef
108
109hi def link ktBoolean Boolean
110hi def link ktConstant Constant
111
112hi def link ktTodo Todo
113hi def link ktShebang Comment
114hi def link ktLineComment Comment
115hi def link ktComment Comment
116hi def link ktCommentMatchGroup Comment
117hi def link ktDocComment Comment
118hi def link ktDocTag Special
119hi def link ktDocTagParam Identifier
120
121hi def link ktSpecialChar SpecialChar
122hi def link ktSpecialCharError Error
123hi def link ktString String
124hi def link ktCharacter Character
125
126hi def link ktAnnotation Identifier
127hi def link ktLabel Identifier
128
129hi def link ktSimpleInterpolation Identifier
130hi def link ktComplexInterpolationBrace Identifier
131
132hi def link ktNumber Number
133hi def link ktFloat Float
134
135hi def link ktExclExcl Special
136hi def link ktArrow Structure
137
138let b:current_syntax = 'kotlin'
139
diff --git a/syntax/proto.vim b/syntax/proto.vim
new file mode 100644
index 0000000..8545631
--- /dev/null
+++ b/syntax/proto.vim
@@ -0,0 +1,106 @@
1" Protocol Buffers - Google's data interchange format
2" Copyright 2008 Google Inc. All rights reserved.
3" https://developers.google.com/protocol-buffers/
4"
5" Redistribution and use in source and binary forms, with or without
6" modification, are permitted provided that the following conditions are
7" met:
8"
9" * Redistributions of source code must retain the above copyright
10" notice, this list of conditions and the following disclaimer.
11" * Redistributions in binary form must reproduce the above
12" copyright notice, this list of conditions and the following disclaimer
13" in the documentation and/or other materials provided with the
14" distribution.
15" * Neither the name of Google Inc. nor the names of its
16" contributors may be used to endorse or promote products derived from
17" this software without specific prior written permission.
18"
19" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23" OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31" This is the Vim syntax file for Google Protocol Buffers.
32"
33" Usage:
34"
35" 1. cp proto.vim ~/.vim/syntax/
36" 2. Add the following to ~/.vimrc:
37"
38" augroup filetype
39" au! BufRead,BufNewFile *.proto setfiletype proto
40" augroup end
41"
42" Or just create a new file called ~/.vim/ftdetect/proto.vim with the
43" previous lines on it.
44
45if version < 600
46 syntax clear
47elseif exists("b:current_syntax")
48 finish
49endif
50
51syn case match
52
53syn keyword pbTodo contained TODO FIXME XXX
54syn cluster pbCommentGrp contains=pbTodo
55
56syn keyword pbSyntax syntax import option
57syn keyword pbStructure package message group oneof
58syn keyword pbRepeat optional required repeated
59syn keyword pbDefault default
60syn keyword pbExtend extend extensions to max reserved
61syn keyword pbRPC service rpc returns
62
63syn keyword pbType int32 int64 uint32 uint64 sint32 sint64
64syn keyword pbType fixed32 fixed64 sfixed32 sfixed64
65syn keyword pbType float double bool string bytes
66syn keyword pbTypedef enum
67syn keyword pbBool true false
68
69syn match pbInt /-\?\<\d\+\>/
70syn match pbInt /\<0[xX]\x+\>/
71syn match pbFloat /\<-\?\d*\(\.\d*\)\?/
72syn region pbComment start="\/\*" end="\*\/" contains=@pbCommentGrp
73syn region pbComment start="//" skip="\\$" end="$" keepend contains=@pbCommentGrp
74syn region pbString start=/"/ skip=/\\./ end=/"/
75syn region pbString start=/'/ skip=/\\./ end=/'/
76
77if version >= 508 || !exists("did_proto_syn_inits")
78 if version < 508
79 let did_proto_syn_inits = 1
80 command -nargs=+ HiLink hi link <args>
81 else
82 command -nargs=+ HiLink hi def link <args>
83 endif
84
85 HiLink pbTodo Todo
86
87 HiLink pbSyntax Include
88 HiLink pbStructure Structure
89 HiLink pbRepeat Repeat
90 HiLink pbDefault Keyword
91 HiLink pbExtend Keyword
92 HiLink pbRPC Keyword
93 HiLink pbType Type
94 HiLink pbTypedef Typedef
95 HiLink pbBool Boolean
96
97 HiLink pbInt Number
98 HiLink pbFloat Float
99 HiLink pbComment Comment
100 HiLink pbString String
101
102 delcommand HiLink
103endif
104
105let b:current_syntax = "proto"
106