7
|
1 " Vim syntax file
|
|
2 " Language: Matlab
|
2043
|
3 " Maintainer: Maurizio Tranchero - maurizio(.)tranchero(@)gmail(.)com
|
2034
|
4 " Credits: Preben 'Peppe' Guldberg <peppe-vim@wielders.org>
|
7
|
5 " Original author: Mario Eusebio
|
2043
|
6 " Last Change: Wed Jan 13 11:12:34 CET 2010
|
2908
|
7 " sinh added to matlab implicit commands
|
|
8 " Change History:
|
2043
|
9 " - 'global' and 'persistent' keyword are now recognized
|
7
|
10
|
|
11 " For version 5.x: Clear all syntax items
|
|
12 " For version 6.x: Quit when a syntax file was already loaded
|
|
13 if version < 600
|
|
14 syntax clear
|
|
15 elseif exists("b:current_syntax")
|
|
16 finish
|
|
17 endif
|
|
18
|
|
19 syn keyword matlabStatement return
|
|
20 syn keyword matlabLabel case switch
|
|
21 syn keyword matlabConditional else elseif end if otherwise
|
|
22 syn keyword matlabRepeat do for while
|
2034
|
23 " MT_ADDON - added exception-specific keywords
|
|
24 syn keyword matlabExceptions try catch
|
|
25 syn keyword matlabOO classdef properties events methods
|
7
|
26
|
|
27 syn keyword matlabTodo contained TODO
|
2043
|
28 syn keyword matlabScope global persistent
|
7
|
29
|
|
30 " If you do not want these operators lit, uncommment them and the "hi link" below
|
|
31 syn match matlabArithmeticOperator "[-+]"
|
|
32 syn match matlabArithmeticOperator "\.\=[*/\\^]"
|
|
33 syn match matlabRelationalOperator "[=~]="
|
|
34 syn match matlabRelationalOperator "[<>]=\="
|
|
35 syn match matlabLogicalOperator "[&|~]"
|
|
36
|
|
37 syn match matlabLineContinuation "\.\{3}"
|
|
38
|
|
39 "syn match matlabIdentifier "\<\a\w*\>"
|
|
40
|
|
41 " String
|
2034
|
42 " MT_ADDON - added 'skip' in order to deal with 'tic' escaping sequence
|
2043
|
43 syn region matlabString start=+'+ end=+'+ oneline skip=+''+
|
7
|
44
|
|
45 " If you don't like tabs
|
|
46 syn match matlabTab "\t"
|
|
47
|
|
48 " Standard numbers
|
|
49 syn match matlabNumber "\<\d\+[ij]\=\>"
|
|
50 " floating point number, with dot, optional exponent
|
|
51 syn match matlabFloat "\<\d\+\(\.\d*\)\=\([edED][-+]\=\d\+\)\=[ij]\=\>"
|
|
52 " floating point number, starting with a dot, optional exponent
|
|
53 syn match matlabFloat "\.\d\+\([edED][-+]\=\d\+\)\=[ij]\=\>"
|
|
54
|
|
55 " Transpose character and delimiters: Either use just [...] or (...) aswell
|
|
56 syn match matlabDelimiter "[][]"
|
|
57 "syn match matlabDelimiter "[][()]"
|
|
58 syn match matlabTransposeOperator "[])a-zA-Z0-9.]'"lc=1
|
|
59
|
|
60 syn match matlabSemicolon ";"
|
|
61
|
2043
|
62 syn match matlabComment "%.*$" contains=matlabTodo,matlabTab
|
2034
|
63 " MT_ADDON - correctly highlights words after '...' as comments
|
2043
|
64 syn match matlabComment "\.\.\..*$" contains=matlabTodo,matlabTab
|
|
65 syn region matlabMultilineComment start=+%{+ end=+%}+ contains=matlabTodo,matlabTab
|
7
|
66
|
|
67 syn keyword matlabOperator break zeros default margin round ones rand
|
|
68 syn keyword matlabOperator ceil floor size clear zeros eye mean std cov
|
|
69
|
|
70 syn keyword matlabFunction error eval function
|
|
71
|
|
72 syn keyword matlabImplicit abs acos atan asin cos cosh exp log prod sum
|
2908
|
73 syn keyword matlabImplicit log10 max min sign sin sinh sqrt tan reshape
|
7
|
74
|
|
75 syn match matlabError "-\=\<\d\+\.\d\+\.[^*/\\^]"
|
|
76 syn match matlabError "-\=\<\d\+\.\d\+[eEdD][-+]\=\d\+\.\([^*/\\^]\)"
|
|
77
|
|
78 " Define the default highlighting.
|
|
79 " For version 5.7 and earlier: only when not done already
|
|
80 " For version 5.8 and later: only when an item doesn't have highlighting yet
|
|
81 if version >= 508 || !exists("did_matlab_syntax_inits")
|
|
82 if version < 508
|
|
83 let did_matlab_syntax_inits = 1
|
|
84 command -nargs=+ HiLink hi link <args>
|
|
85 else
|
|
86 command -nargs=+ HiLink hi def link <args>
|
|
87 endif
|
|
88
|
|
89 HiLink matlabTransposeOperator matlabOperator
|
2034
|
90 HiLink matlabOperator Operator
|
|
91 HiLink matlabLineContinuation Special
|
7
|
92 HiLink matlabLabel Label
|
|
93 HiLink matlabConditional Conditional
|
2034
|
94 HiLink matlabExceptions Conditional
|
7
|
95 HiLink matlabRepeat Repeat
|
|
96 HiLink matlabTodo Todo
|
|
97 HiLink matlabString String
|
|
98 HiLink matlabDelimiter Identifier
|
|
99 HiLink matlabTransposeOther Identifier
|
|
100 HiLink matlabNumber Number
|
|
101 HiLink matlabFloat Float
|
2034
|
102 HiLink matlabFunction Function
|
7
|
103 HiLink matlabError Error
|
2034
|
104 HiLink matlabImplicit matlabStatement
|
7
|
105 HiLink matlabStatement Statement
|
2034
|
106 HiLink matlabOO Statement
|
7
|
107 HiLink matlabSemicolon SpecialChar
|
|
108 HiLink matlabComment Comment
|
2034
|
109 HiLink matlabMultilineComment Comment
|
2043
|
110 HiLink matlabScope Type
|
7
|
111
|
|
112 HiLink matlabArithmeticOperator matlabOperator
|
|
113 HiLink matlabRelationalOperator matlabOperator
|
|
114 HiLink matlabLogicalOperator matlabOperator
|
|
115
|
|
116 "optional highlighting
|
|
117 "HiLink matlabIdentifier Identifier
|
|
118 "HiLink matlabTab Error
|
|
119
|
|
120 delcommand HiLink
|
|
121 endif
|
|
122
|
|
123 let b:current_syntax = "matlab"
|
|
124
|
|
125 "EOF vim: ts=8 noet tw=100 sw=8 sts=0
|