Bram Moolenaar | 438f67a | 2014-01-07 06:09:28 +0100 | [diff] [blame] | 1 | " 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 |
| 15 | if version < 600 |
| 16 | syntax clear |
| 17 | elseif exists("b:current_syntax") |
| 18 | finish |
| 19 | endif |
| 20 | |
| 21 | " Read the C syntax to start with |
| 22 | if version < 600 |
| 23 | so <sfile>:p:h/cpp.vim |
| 24 | else |
| 25 | runtime! syntax/cpp.vim |
| 26 | endif |
| 27 | |
| 28 | syn keyword arduinoConstant HIGH LOW INPUT OUTPUT |
| 29 | syn keyword arduinoConstant DEC BIN HEX OCT BYTE |
| 30 | syn keyword arduinoConstant PI HALF_PI TWO_PI |
| 31 | syn keyword arduinoConstant LSBFIRST MSBFIRST |
| 32 | syn keyword arduinoConstant CHANGE FALLING RISING |
| 33 | syn keyword arduinoConstant SERIAL DISPLAY |
| 34 | syn keyword arduinoConstant DEFAULT EXTERNAL INTERNAL INTERNAL1V1 INTERNAL2V56 |
| 35 | |
| 36 | syn keyword arduinoStdFunc abs acos asin atan atan2 ceil constrain |
| 37 | syn keyword arduinoStdFunc cos degrees exp floor log |
| 38 | syn keyword arduinoStdFunc map max min pow radians |
| 39 | syn keyword arduinoStdFunc round sin sq sqrt tan |
| 40 | syn keyword arduinoStdFunc randomSeed random |
| 41 | |
| 42 | syn keyword arduinoFunc analogReference analogRead analogWrite |
| 43 | syn keyword arduinoFunc attachInterrupt detachInterrupt interrupts noInterrupts |
| 44 | syn keyword arduinoFunc lowByte highByte bitRead bitWrite bitSet bitClear |
| 45 | syn keyword arduinoFunc millis micros delay delayMicroseconds |
| 46 | syn keyword arduinoFunc pinMode digitalWrite digitalRead |
| 47 | syn keyword arduinoFunc tone noTone pulseIn shiftOut |
| 48 | |
| 49 | syn keyword arduinoMethod setup loop |
| 50 | syn keyword arduinoMethod begin end available read flush print println write peek |
| 51 | |
| 52 | syn keyword arduinoType boolean byte word String |
| 53 | |
| 54 | syn keyword arduinoModule Serial Serial1 Serial2 Serial3 |
| 55 | |
| 56 | hi def link arduinoType Type |
| 57 | hi def link arduinoConstant Constant |
| 58 | hi def link arduinoStdFunc Function |
| 59 | hi def link arduinoFunc Function |
| 60 | hi def link arduinoMethod Function |
| 61 | hi def link arduinoModule Identifier |