blob: 14299a441a3811ad92f9b499a03e287db242a64c [file] [log] [blame]
Bram Moolenaar438f67a2014-01-07 06:09:28 +01001" Vim syntax file
2" Language: Arduino
3" Maintainer: Johannes Hoff <johannes@johanneshoff.com>
4" Last Change: 2011 June 3
5" License: VIM license (:help license, replace vim by arduino.vim)
6
7" Syntax highlighting like in the Arduino IDE
8" Keywords extracted from <arduino>/build/shared/lib/keywords.txt (arduino
9" version 0021)
10
11" Thanks to Rik, Erik Nomitch, Adam Obeng and Graeme Cross for helpful feedback!
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" Read the C syntax to start with
22if version < 600
23 so <sfile>:p:h/cpp.vim
24else
25 runtime! syntax/cpp.vim
26endif
27
28syn keyword arduinoConstant HIGH LOW INPUT OUTPUT
29syn keyword arduinoConstant DEC BIN HEX OCT BYTE
30syn keyword arduinoConstant PI HALF_PI TWO_PI
31syn keyword arduinoConstant LSBFIRST MSBFIRST
32syn keyword arduinoConstant CHANGE FALLING RISING
33syn keyword arduinoConstant SERIAL DISPLAY
34syn keyword arduinoConstant DEFAULT EXTERNAL INTERNAL INTERNAL1V1 INTERNAL2V56
35
36syn keyword arduinoStdFunc abs acos asin atan atan2 ceil constrain
37syn keyword arduinoStdFunc cos degrees exp floor log
38syn keyword arduinoStdFunc map max min pow radians
39syn keyword arduinoStdFunc round sin sq sqrt tan
40syn keyword arduinoStdFunc randomSeed random
41
42syn keyword arduinoFunc analogReference analogRead analogWrite
43syn keyword arduinoFunc attachInterrupt detachInterrupt interrupts noInterrupts
44syn keyword arduinoFunc lowByte highByte bitRead bitWrite bitSet bitClear
45syn keyword arduinoFunc millis micros delay delayMicroseconds
46syn keyword arduinoFunc pinMode digitalWrite digitalRead
47syn keyword arduinoFunc tone noTone pulseIn shiftOut
48
49syn keyword arduinoMethod setup loop
50syn keyword arduinoMethod begin end available read flush print println write peek
51
52syn keyword arduinoType boolean byte word String
53
54syn keyword arduinoModule Serial Serial1 Serial2 Serial3
55
56hi def link arduinoType Type
57hi def link arduinoConstant Constant
58hi def link arduinoStdFunc Function
59hi def link arduinoFunc Function
60hi def link arduinoMethod Function
61hi def link arduinoModule Identifier