blob: a107e7d9fee0b28b6e8c47191d2391cbd7bb4694 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: Visual Basic
3" Maintainer: Tim Chase <vb.vim@tim.thechases.com>
4" Former Maintainer: Robert M. Cortopassi <cortopar@mindspring.com>
5" (tried multiple times to contact, but email bounced)
6" Last Change: 2004 May 25
7" 2004 May 30 Added a few keywords
8
9" This was thrown together after seeing numerous requests on the
10" VIM and VIM-DEV mailing lists. It is by no means complete.
11" Send comments, suggestions and requests to the maintainer.
12
13" For version 5.x: Clear all syntax items
14" For version 6.x: Quit when a syntax file was already loaded
15if version < 600
16 syntax clear
17elseif exists("b:current_syntax")
18 finish
19endif
20
21" VB is case insensitive
22syn case ignore
23
24syn keyword vbStatement Alias AppActivate As Base Beep Call Case
25syn keyword vbStatement ChDir ChDrive Const Declare DefBool DefByte
26syn keyword vbStatement DefCur DefDate DefDbl DefDec DefInt
27syn keyword vbStatement DefLng DefObj DefSng DefStr Deftype
28syn keyword vbStatement DefVar DeleteSetting Dim Do Each Else
29syn keyword vbStatement ElseIf End Enum Erase Event Exit Explicit
30syn keyword vbStatement FileCopy For ForEach Function Get GoSub
31syn keyword vbStatement GoTo If Implements Kill Let Lib LineInput
32syn keyword vbStatement Lock Loop LSet MkDir Name Next OnError On
33syn keyword vbStatement Option Preserve Private Property Public Put
34syn keyword vbStatement RaiseEvent Randomize ReDim Reset Resume
35syn keyword vbStatement Return RmDir RSet SavePicture SaveSetting
36syn keyword vbStatement SendKeys Select SetAttr Static Step Sub
37syn keyword vbStatement Then Type Unlock Until Wend While Width
38syn keyword vbStatement With Write
39
40syn keyword vbFunction Abs Array Asc AscB AscW Atn Avg CBool
41syn keyword vbFunction CByte CCur CDate CDbl Cdec Choose Chr
42syn keyword vbFunction ChrB ChrW CInt CLng Command Cos Count
43syn keyword vbFunction CreateObject CSng CStr CurDir CVar
44syn keyword vbFunction CVDate CVErr DateAdd DateDiff DatePart
45syn keyword vbFunction DateSerial DateValue Day DDB Dir
46syn keyword vbFunction DoEvents Environ EOF Error Exp FileAttr
47syn keyword vbFunction FileDateTime FileLen Fix Format FreeFile
48syn keyword vbFunction FV GetAllStrings GetAttr
49syn keyword vbFunction GetAutoServerSettings GetObject
50syn keyword vbFunction GetSetting Hex Hour IIf IMEStatus Input
51syn keyword vbFunction InputB InputBox InStr InstB Int IPmt
52syn keyword vbFunction IsArray IsDate IsEmpty IsError IsMissing
53syn keyword vbFunction IsNull IsNumeric IsObject LBound LCase
54syn keyword vbFunction Left LeftB Len LenB LoadPicture Loc LOF
55syn keyword vbFunction Log LTrim Max Mid MidB Min Minute MIRR
56syn keyword vbFunction Month MsgBox Now NPer NPV Oct Partition
57syn keyword vbFunction Pmt PPmt PV QBColor Rate RGB Right
58syn keyword vbFunction RightB Rnd RTrim Second Seek Sgn Shell
59syn keyword vbFunction Sin SLN Space Spc Sqr StDev StDevP Str
60syn keyword vbFunction StrComp StrConv String Switch Sum SYD
61syn keyword vbFunction Tab Tan Time Timer TimeSerial TimeValue
62syn keyword vbFunction Trim TypeName UBound UCase Val Var VarP
63syn keyword vbFunction VarType Weekday Year
64
65syn keyword vbMethods Accept Activate Add AddCustom AddFile
66syn keyword vbMethods AddFromFile AddFromTemplate AddItem
67syn keyword vbMethods AddNew AddToAddInToolbar
68syn keyword vbMethods AddToolboxProgID Append AppendChunk
69syn keyword vbMethods Arrange Assert AsyncRead BatchUpdate
70syn keyword vbMethods BeginTrans Bind Cancel CancelAsyncRead
71syn keyword vbMethods CancelBatch CancelUpdate
72syn keyword vbMethods CanPropertyChange CaptureImage CellText
73syn keyword vbMethods CellValue Circle Clear ClearFields
74syn keyword vbMethods ClearSel ClearSelCols Clone Close Cls
75syn keyword vbMethods ColContaining ColumnSize CommitTrans
76syn keyword vbMethods CompactDatabase Compose Connect Copy
77syn keyword vbMethods CopyQueryDef CreateDatabase
78syn keyword vbMethods CreateDragImage CreateEmbed CreateField
79syn keyword vbMethods CreateGroup CreateIndex CreateLink
80syn keyword vbMethods CreatePreparedStatement CreatePropery
81syn keyword vbMethods CreateQuery CreateQueryDef
82syn keyword vbMethods CreateRelation CreateTableDef CreateUser
83syn keyword vbMethods CreateWorkspace Customize Delete
84syn keyword vbMethods DeleteColumnLabels DeleteColumns
85syn keyword vbMethods DeleteRowLabels DeleteRows DoVerb Drag
86syn keyword vbMethods Draw Edit EditCopy EditPaste EndDoc
87syn keyword vbMethods EnsureVisible EstablishConnection
88syn keyword vbMethods Execute ExtractIcon Fetch FetchVerbs
89syn keyword vbMethods Files FillCache Find FindFirst FindItem
90syn keyword vbMethods FindLast FindNext FindPrevious Forward
91syn keyword vbMethods GetBookmark GetChunk GetClipString
92syn keyword vbMethods GetData GetFirstVisible GetFormat
93syn keyword vbMethods GetHeader GetLineFromChar GetNumTicks
94syn keyword vbMethods GetRows GetSelectedPart GetText
95syn keyword vbMethods GetVisibleCount GoBack GoForward Hide
96syn keyword vbMethods HitTest HoldFields Idle InitializeLabels
97syn keyword vbMethods InsertColumnLabels InsertColumns
98syn keyword vbMethods InsertObjDlg InsertRowLabels InsertRows
99syn keyword vbMethods Item KillDoc Layout Line LinkExecute
100syn keyword vbMethods LinkPoke LinkRequest LinkSend Listen
101syn keyword vbMethods LoadFile LoadResData LoadResPicture
102syn keyword vbMethods LoadResString LogEvent MakeCompileFile
103syn keyword vbMethods MakeReplica MoreResults Move MoveData
104syn keyword vbMethods MoveFirst MoveLast MoveNext MovePrevious
105syn keyword vbMethods NavigateTo NewPage NewPassword
106syn keyword vbMethods NextRecordset OLEDrag OnAddinsUpdate
107syn keyword vbMethods OnConnection OnDisconnection
108syn keyword vbMethods OnStartupComplete Open OpenConnection
109syn keyword vbMethods OpenDatabase OpenQueryDef OpenRecordset
110syn keyword vbMethods OpenResultset OpenURL Overlay
111syn keyword vbMethods PaintPicture Paste PastSpecialDlg
112syn keyword vbMethods PeekData Play Point PopulatePartial
113syn keyword vbMethods PopupMenu Print PrintForm
114syn keyword vbMethods PropertyChanged PSet Quit Raise
115syn keyword vbMethods RandomDataFill RandomFillColumns
116syn keyword vbMethods RandomFillRows rdoCreateEnvironment
117syn keyword vbMethods rdoRegisterDataSource ReadFromFile
118syn keyword vbMethods ReadProperty Rebind ReFill Refresh
119syn keyword vbMethods RefreshLink RegisterDatabase Reload
120syn keyword vbMethods Remove RemoveAddInFromToolbar RemoveItem
121syn keyword vbMethods Render RepairDatabase Reply ReplyAll
122syn keyword vbMethods Requery ResetCustom ResetCustomLabel
123syn keyword vbMethods ResolveName RestoreToolbar Resync
124syn keyword vbMethods Rollback RollbackTrans RowBookmark
125syn keyword vbMethods RowContaining RowTop Save SaveAs
126syn keyword vbMethods SaveFile SaveToFile SaveToolbar
127syn keyword vbMethods SaveToOle1File Scale ScaleX ScaleY
128syn keyword vbMethods Scroll SelectAll SelectPart SelPrint
129syn keyword vbMethods Send SendData Set SetAutoServerSettings
130syn keyword vbMethods SetData SetFocus SetOption SetSize
131syn keyword vbMethods SetText SetViewport Show ShowColor
132syn keyword vbMethods ShowFont ShowHelp ShowOpen ShowPrinter
133syn keyword vbMethods ShowSave ShowWhatsThis SignOff SignOn
134syn keyword vbMethods Size Span SplitContaining StartLabelEdit
135syn keyword vbMethods StartLogging Stop Synchronize TextHeight
136syn keyword vbMethods TextWidth ToDefaults TwipsToChartPart
137syn keyword vbMethods TypeByChartType Update UpdateControls
138syn keyword vbMethods UpdateRecord UpdateRow Upto
139syn keyword vbMethods WhatsThisMode WriteProperty ZOrder
140
141syn keyword vbEvents AccessKeyPress AfterAddFile
142syn keyword vbEvents AfterChangeFileName AfterCloseFile
143syn keyword vbEvents AfterColEdit AfterColUpdate AfterDelete
144syn keyword vbEvents AfterInsert AfterLabelEdit
145syn keyword vbEvents AfterRemoveFile AfterUpdate
146syn keyword vbEvents AfterWriteFile AmbienChanged
147syn keyword vbEvents ApplyChanges Associate AsyncReadComplete
148syn keyword vbEvents AxisActivated AxisLabelActivated
149syn keyword vbEvents AxisLabelSelected AxisLabelUpdated
150syn keyword vbEvents AxisSelected AxisTitleActivated
151syn keyword vbEvents AxisTitleSelected AxisTitleUpdated
152syn keyword vbEvents AxisUpdated BeforeClick BeforeColEdit
153syn keyword vbEvents BeforeColUpdate BeforeConnect
154syn keyword vbEvents BeforeDelete BeforeInsert
155syn keyword vbEvents BeforeLabelEdit BeforeLoadFile
156syn keyword vbEvents BeforeUpdate ButtonClick ButtonCompleted
157syn keyword vbEvents ButtonGotFocus ButtonLostFocus Change
158syn keyword vbEvents ChartActivated ChartSelected
159syn keyword vbEvents ChartUpdated Click ColEdit Collapse
160syn keyword vbEvents ColResize ColumnClick Compare
161syn keyword vbEvents ConfigChageCancelled ConfigChanged
162syn keyword vbEvents ConnectionRequest DataArrival
163syn keyword vbEvents DataChanged DataUpdated DblClick
164syn keyword vbEvents Deactivate DeviceArrival
165syn keyword vbEvents DeviceOtherEvent DeviceQueryRemove
166syn keyword vbEvents DeviceQueryRemoveFailed
167syn keyword vbEvents DeviceRemoveComplete DeviceRemovePending
168syn keyword vbEvents DevModeChange Disconnect DisplayChanged
169syn keyword vbEvents Dissociate DoGetNewFileName Done
170syn keyword vbEvents DonePainting DownClick DragDrop DragOver
171syn keyword vbEvents DropDown EditProperty EnterCell
172syn keyword vbEvents EnterFocus ExitFocus Expand
173syn keyword vbEvents FootnoteActivated FootnoteSelected
174syn keyword vbEvents FootnoteUpdated GotFocus HeadClick
175syn keyword vbEvents InfoMessage Initialize IniProperties
176syn keyword vbEvents ItemActivated ItemAdded ItemCheck
177syn keyword vbEvents ItemClick ItemReloaded ItemRemoved
178syn keyword vbEvents ItemRenamed ItemSeletected KeyDown
179syn keyword vbEvents KeyPress KeyUp LeaveCell LegendActivated
180syn keyword vbEvents LegendSelected LegendUpdated LinkClose
181syn keyword vbEvents LinkError LinkNotify LinkOpen Load
182syn keyword vbEvents LostFocus MouseDown MouseMove MouseUp
183syn keyword vbEvents NodeClick ObjectMove OLECompleteDrag
184syn keyword vbEvents OLEDragDrop OLEDragOver OLEGiveFeedback
185syn keyword vbEvents OLESetData OLEStartDrag OnAddNew OnComm
186syn keyword vbEvents Paint PanelClick PanelDblClick
187syn keyword vbEvents PathChange PatternChange PlotActivated
188syn keyword vbEvents PlotSelected PlotUpdated PointActivated
189syn keyword vbEvents PointLabelActivated PointLabelSelected
190syn keyword vbEvents PointLabelUpdated PointSelected
191syn keyword vbEvents PointUpdated PowerQuerySuspend
192syn keyword vbEvents PowerResume PowerStatusChanged
193syn keyword vbEvents PowerSuspend QueryChangeConfig
194syn keyword vbEvents QueryComplete QueryCompleted
195syn keyword vbEvents QueryTimeout QueryUnload ReadProperties
196syn keyword vbEvents Reposition RequestChangeFileName
197syn keyword vbEvents RequestWriteFile Resize ResultsChanged
198syn keyword vbEvents RowColChange RowCurrencyChange RowResize
199syn keyword vbEvents RowStatusChanged SelChange
200syn keyword vbEvents SelectionChanged SendComplete
201syn keyword vbEvents SendProgress SeriesActivated
202syn keyword vbEvents SeriesSelected SeriesUpdated
203syn keyword vbEvents SettingChanged SplitChange StateChanged
204syn keyword vbEvents StatusUpdate SysColorsChanged Terminate
205syn keyword vbEvents TimeChanged TitleActivated TitleSelected
206syn keyword vbEvents TitleActivated UnboundAddData
207syn keyword vbEvents UnboundDeleteRow
208syn keyword vbEvents UnboundGetRelativeBookmark
209syn keyword vbEvents UnboundReadData UnboundWriteData Unload
210syn keyword vbEvents UpClick Updated Validate ValidationError
211syn keyword vbEvents WillAssociate WillChangeData
212syn keyword vbEvents WillDissociate WillExecute
213syn keyword vbEvents WillUpdateRows WriteProperties
214
215syn keyword vbTypes Boolean Byte Currency Date Decimal
216syn keyword vbTypes Double Empty Integer Long Single String
217
218syn match vbOperator "[()+.,\-/*=&]"
219syn match vbOperator "[<>]=\="
220syn match vbOperator "<>"
221syn match vbOperator "\s\+_$"
222syn keyword vbOperator And Or Not Xor Mod In Is Imp Eqv
223syn keyword vbOperator To ByVal ByRef
224syn keyword vbConst True False Null Nothing
225
226syn keyword vbTodo contained TODO
227
228"integer number, or floating point number without a dot.
229syn match vbNumber "\<\d\+\>"
230"floating point number, with dot
231syn match vbNumber "\<\d\+\.\d*\>"
232"floating point number, starting with a dot
233syn match vbNumber "\.\d\+\>"
234
235" String and Character contstants
236syn region vbString start=+"+ end=+"+
237syn region vbComment start="\<REM\>" end="$" contains=vbTodo
238syn region vbComment start="'" end="$" contains=vbTodo
239syn region vbLineNumber start="^\d" end="\s"
240syn match vbTypeSpecifier "[a-zA-Z0-9][\$%&!#]"ms=s+1
241
242" Define the default highlighting.
243" For version 5.7 and earlier: only when not done already
244" For version 5.8 and later: only when an item doesn't have highlighting yet
245if version >= 508 || !exists("did_vb_syntax_inits")
246 if version < 508
247 let did_vb_syntax_inits = 1
248 command -nargs=+ HiLink hi link <args>
249 else
250 command -nargs=+ HiLink hi def link <args>
251 endif
252
253 HiLink vbLineNumber Comment
254 HiLink vbNumber Number
255 HiLink vbConst Constant
256 HiLink vbError Error
257 HiLink vbStatement Statement
258 HiLink vbString String
259 HiLink vbComment Comment
260 HiLink vbTodo Todo
261 HiLink vbFunction Identifier
262 HiLink vbMethods PreProc
263 HiLink vbEvents Special
264 HiLink vbTypeSpecifier Type
265 HiLink vbTypes Type
266 HiLink vbOperator Operator
267
268 delcommand HiLink
269endif
270
271let b:current_syntax = "vb"
272
273" vim: ts=8