Skip to content

Added definitions for Arduino 1.6.0 #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 39 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,42 @@
vim-arduino-syntax
==================

Love Arduino and Vim? Then use this syntax file and get syntax highlighting for Arduino functions in vim.

Installation
============

Manual
------
- Copy `syntax/arduino.vim` file into your `~/.vim/syntax` directory
- Copy `ftdetect/arduino.vim` file into your `~/.vim/ftdetect` directory

Using [Vundle](https://github.com/gmarik/vundle)
-------------

```VimL

Plugin "sudar/vim-arduino-syntax"

And :PluginInstall

```
Credit
======

The syntax file was originally created by Johannes Hoff. I regenerated the file using his [python script](https://bitbucket.org/johannes/arduino-vim-syntax) and added some additional changes on top of it.

TODO
====

- Create a separate branch for Arduino 1.5
- Automatically include keywords from keywords.txt of Arduino libraries

Contributions
================

#vim-arduino-syntax

Are you in love with Vim and can't stand the [Official Arduino IDE](http://arduino.cc/en/Main/Software)

##Features
* Arduino 1.5.8 support (check beta branch)
* Arduino 1.0. support (main branch)
* Arduino indent and syntax highlighting
* Support for libraries provided by the IDE
* Support for external libraries (on request)
* Autocompletion (using omnicomplete)

##TODO
* Let us know if you want any new features

##Installation

This plugin follows the standard runtime path structure, and as such it can be installed with a variety of plugin managers:

* [Pathogen](https://github.com/tpope/vim-pathogen)
* `git clone https://github.com/sudar/vim-arduino-syntax`
* Remember to run `:Helptags` to generate help tags
* [NeoBundle](https://github.com/Shougo/neobundle.vim)
* `NeoBundle 'vim-arduino-syntax'`
* [Vundle](https://github.com/gmarik/Vundle.vim)
* `Plugin 'sudar/vim-arduino-syntax'
:PluginInstall`
* manual
* Copy syntax/arduino.vim file into your ~/.vim/syntax directory
Copy ftdetect/arduino.vim file into your ~/.vim/ftdetect directory

##Contributing
Contributions are always welcome in the form of pull requests with explanatory comments.

Other tools for Arduino and Vim
===========================

If you are using Arduino with Vim, then also checkout some of my other projects.
* Add library specific support using instructions from here. (coming soon)
* Request adding more external libraries (complete within a few hours)
* Report bugs
* Request support for libraries

- [Arduino snippets for Vim](https://github.com/sudar/vim-arduino-snippets)
- [Arduino Make file](https://github.com/sudar/Arduino-Makefile)
##Contributors
* [z3t0](https://github.com/z3t0) - Active contributor
* [sudar](https://github.com/sudar) - Owner and contributor
175 changes: 141 additions & 34 deletions syntax/arduino.vim
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
" Vim syntax file
" Language: Arduino
" Maintainer: Sudar <sudar@sudarmuthu.com>
" Original Author: Johannes Hoff <johannes@johanneshoff.com>
" Last Change: 19 February 2013
" License: VIM license (:help license, replace vim by arduino.vim)
" Maintainer: Rafi Khan <zetoslab@gmail.com>
" Last Change: 09 March 2015

" Syntax highlighting like in the Arduino IDE
" Automatically generated by the script available at
" https://bitbucket.org/johannes/arduino-vim-syntax
" Using keywords from <arduino>/lib/keywords.txt
" From version:
" Rafi Khan Copyright (c) 2015

" Syntax highlighting like in the Arduino IDE
" From version: unknown

" Thanks to original author Johannes Hoff and Rik, Erik Nomitch, Adam Obeng and Graeme Cross for helpful feedback!

" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
Expand All @@ -28,33 +24,144 @@ else
runtime! syntax/cpp.vim
endif

syn keyword arduinoConstant BIN CHANGE DEC DEFAULT EXTERNAL FALLING HALF_PI HEX
syn keyword arduinoConstant HIGH INPUT INPUT_PULLUP INTERNAL INTERNAL1V1
syn keyword arduinoConstant INTERNAL2V56 LOW LSBFIRST MSBFIRST OCT OUTPUT PI
syn keyword arduinoConstant RISING TWO_PI

syn keyword arduinoFunc analogRead analogReference analogWrite
syn keyword arduinoFunc attachInterrupt bit bitClear bitRead bitSet
syn keyword arduinoFunc bitWrite delay delayMicroseconds detachInterrupt
syn keyword arduinoFunc digitalRead digitalWrite highByte interrupts
syn keyword arduinoFunc lowByte micros millis noInterrupts noTone pinMode
syn keyword arduinoFunc pulseIn shiftIn shiftOut tone

syn keyword arduinoMethod available begin end find findUntil flush loop
syn keyword arduinoMethod parseFloat parseInt peek print println read
syn keyword arduinoMethod readBytes readBytesUntil setTimeout setup

syn keyword arduinoModule Serial Serial1 Serial2 Serial3
"C:/Program Files (x86)/Arduino\hardware\arduino\avr\libraries\EEPROM\keywords.txt{{{
syn keyword arduinoConstant EEPROM
"}}}
"C:/Program Files (x86)/Arduino\hardware\arduino\avr\libraries\SoftwareSerial\keywords.txt{{{
syn keyword arduinoFunc SoftwareSerial begin end read write available isListening overflow flush listen
syn keyword arduinoFunc peek
"}}}
"C:/Program Files (x86)/Arduino\hardware\arduino\avr\libraries\SPI\keywords.txt{{{
syn keyword arduinoConstant SPI SPI_CLOCK_DIV4 SPI_CLOCK_DIV16 SPI_CLOCK_DIV64 SPI_CLOCK_DIV128 SPI_CLOCK_DIV2 SPI_CLOCK_DIV8 SPI_CLOCK_DIV32 SPI_CLOCK_DIV64 SPI_MODE0
syn keyword arduinoConstant SPI_MODE1 SPI_MODE2 SPI_MODE3
syn keyword arduinoFunc begin end transfer setBitOrder setDataMode setClockDivider
"}}}
"C:/Program Files (x86)/Arduino\hardware\arduino\avr\libraries\Wire\keywords.txt{{{
syn keyword arduinoFunc begin setClock beginTransmission endTransmission requestFrom send receive onReceive onRequest Wire
"}}}
"C:/Program Files (x86)/Arduino\hardware\arduino\sam\libraries\SPI\keywords.txt{{{
syn keyword arduinoConstant SPI SPI_MODE0 SPI_MODE1 SPI_MODE2 SPI_MODE3 SPI_CONTINUE SPI_LAST
syn keyword arduinoFunc begin end transfer setDataMode setClockDivider
"}}}
"C:/Program Files (x86)/Arduino\hardware\arduino\sam\libraries\Wire\keywords.txt{{{
syn keyword arduinoFunc begin setClock beginTransmission endTransmission requestFrom send receive onReceive onRequest Wire
syn keyword arduinoFunc Wire1
"}}}
"C:/Program Files (x86)/Arduino\lib\keywords.txt{{{
syn keyword arduinoConstant HIGH LOW INPUT INPUT_PULLUP OUTPUT DEC BIN HEX OCT PI
syn keyword arduinoConstant HALF_PI TWO_PI LSBFIRST MSBFIRST CHANGE FALLING RISING DEFAULT EXTERNAL INTERNAL
syn keyword arduinoConstant INTERNAL1V1 INTERNAL2V56
syn keyword arduinoType boolean break byte case char class const continue default do
syn keyword arduinoType double else false float for if int long new null
syn keyword arduinoType private protected public register return short signed static String switch
syn keyword arduinoType this throw try true unsigned void while word boolean byte
syn keyword arduinoType char float int long word
syn keyword arduinoFunc abs acos asin atan atan2 ceil constrain cos degrees exp
syn keyword arduinoFunc floor log map max min radians random randomSeed round sin
syn keyword arduinoFunc sq sqrt tan pow bitRead bitWrite bitSet bitClear bit highByte
syn keyword arduinoFunc lowByte analogReference analogRead analogWrite attachInterrupt detachInterrupt delay delayMicroseconds digitalWrite digitalRead
syn keyword arduinoFunc interrupts millis micros noInterrupts noTone pinMode pulseIn shiftIn shiftOut tone
syn keyword arduinoFunc yield
syn keyword arduinoIdentifier Serial Serial1 Serial2 Serial3
syn keyword arduinoFunc SerialUSB begin end peek read
syn keyword arduinoFunc print println available availableForWrite flush setTimeout find findUntil parseInt parseFloat
syn keyword arduinoFunc readBytes readBytesUntil readString readStringUntil trim toUpperCase toLowerCase charAt compareTo concat
syn keyword arduinoFunc endsWith startsWith equals equalsIgnoreCase getBytes indexOf lastIndexOf length replace setCharAt
syn keyword arduinoFunc substring toCharArray toInt Keyboard Mouse press release releaseAll accept click
syn keyword arduinoFunc move isPressed setup loop
"}}}
"C:/Program Files (x86)/Arduino\libraries\Audio\keywords.txt{{{
syn keyword arduinoFunc Audio prepare write
"}}}
"C:/Program Files (x86)/Arduino\libraries\Bridge\keywords.txt{{{
syn keyword arduinoConstant FILE_READ FILE_WRITE FILE_APPEND
syn keyword arduinoFunc Bridge FileIO FileSystem Console Process Mailbox HttpClient YunServer YunClient begin
syn keyword arduinoFunc end available read peek write flush bool transfer put get
syn keyword arduinoFunc buffer noBuffer connected File seek position size close name isDirectory
syn keyword arduinoFunc openNextFile rewindDirectory addParameter runAsynchronously run running exitValue runShellCommand runShellCommandAsynchronously readMessage
syn keyword arduinoFunc writeMessage writeJSON message Available getAsynchronously ready getResult accept stop connect connected
"}}}
"C:/Program Files (x86)/Arduino\libraries\Esplora\keywords.txt{{{
syn keyword arduinoConstant JOYSTICK_BASE MAX_CHANNELS CH_SWITCH_1 CH_SWITCH_2 CH_SWITCH_3 CH_SWITCH_4 CH_SLIDER CH_LIGHT CH_TEMPERATURE CH_MIC
syn keyword arduinoConstant CH_JOYSTICK_SW CH_JOYSTICK_X CH_JOYSTICK_Y SWITCH_1 SWITCH_2 SWITCH_3 SWITCH_4 SWITCH_DOWN SWITCH_LEFT SWITCH_UP
syn keyword arduinoConstant SWITCH_RIGHT JOYSTICK_DOWN JOYSTICK_LEFT JOYSTICK_UP PRESSED RELEASED DEGREES_C DEGREES_F X_AXIS Y_AXIS
syn keyword arduinoConstant Z_AXIS
syn keyword arduinoFunc Esplora begin readSlider readLightSensor readTemperature readMicrophone readJoystickSwitch readJoystickButton readJoystickX readJoystickY
syn keyword arduinoFunc readAccelerometer readButton writeRGB writeRed writeGreen writeBlue readRed readGreen readBlue readBlue
syn keyword arduinoFunc readBlue readBlue tone noTone
"}}}
"C:/Program Files (x86)/Arduino\libraries\Ethernet\keywords.txt{{{
syn keyword arduinoFunc Ethernet EthernetClient EthernetServer IPAddress status connect write available read peek
syn keyword arduinoFunc flush stop connected begin beginPacket endPacket parsePacket remoteIP remotePort
"}}}
"C:/Program Files (x86)/Arduino\libraries\Firmata\keywords.txt{{{
syn keyword arduinoConstant MAX_DATA_BYTES DIGITAL_MESSAGE ANALOG_MESSAGE REPORT_ANALOG REPORT_DIGITAL REPORT_VERSION SET_PIN_MODE SYSTEM_RESET START_SYSEX END_SYSEX
syn keyword arduinoConstant PWM TOTAL_ANALOG_PINS TOTAL_DIGITAL_PINS TOTAL_PORTS ANALOG_PORT
syn keyword arduinoFunc Firmata callbackFunction systemResetCallbackFunction stringCallbackFunction sysexCallbackFunction begin begin printVersion blinkVersion printFirmwareVersion
syn keyword arduinoFunc setFirmwareVersion setFirmwareNameAndVersion available processInput sendAnalog sendDigital sendDigitalPortPair sendDigitalPort sendString sendString
syn keyword arduinoFunc sendSysex attach detach flush
"}}}
"C:/Program Files (x86)/Arduino\libraries\GSM\keywords.txt{{{
syn keyword arduinoConstant GSM GSM_SMS GPRS GSMPIN GSMPIN ERROR IDLE CONNECTING GSM_READY GPRS_READY
syn keyword arduinoConstant TRANSPARENT_CONNECTED IDLE_CALL CALLING RECEIVINGCALL TALKING GSM_MODE_UNDEFINED GSM_MODE_EGSM GSM_MODE_DCS GSM_MODE_PCS GSM_MODE_EGSM_DCS
syn keyword arduinoConstant GSM_MODE_GSM850_PCS GSM_MODE_GSM850_EGSM_DCS_PCS
syn keyword arduinoFunc GSMVoiceCall GSMClient GSMServer GSMModem GSMScanner begin shutdown gatVoiceCallStatus ready voiceCall
syn keyword arduinoFunc answerCall hangCall retrieveCallingNumber beginSMS endSMS remoteNumber attachGPRS begnWrite endWrite getIMEI
syn keyword arduinoFunc getCurrentCarrier getSignalStrength readNetworks isPIN checkPIN checkPUK changePIN switchPIN checkReg getPINUsed
syn keyword arduinoFunc setPINUsed getBand setBand getvoiceCallStatus
"}}}
"C:/Program Files (x86)/Arduino\libraries\LiquidCrystal\keywords.txt{{{
syn keyword arduinoFunc LiquidCrystal begin clear home print setCursor cursor noCursor blink noBlink
syn keyword arduinoFunc display noDisplay autoscroll noAutoscroll leftToRight rightToLeft scrollDisplayLeft scrollDisplayRight createChar setRowOffsets
"}}}
"C:/Program Files (x86)/Arduino\libraries\Scheduler\keywords.txt{{{
syn keyword arduinoFunc Scheduler startLoop
"}}}
"C:/Program Files (x86)/Arduino\libraries\SD\keywords.txt{{{
syn keyword arduinoConstant SD FILE_READ FILE_WRITE
syn keyword arduinoFunc File begin exists mkdir remove rmdir open close seek position
syn keyword arduinoFunc size
"}}}
"C:/Program Files (x86)/Arduino\libraries\Servo\keywords.txt{{{
syn keyword arduinoFunc Servo attach detach write read attached writeMicroseconds readMicroseconds
"}}}
"C:/Program Files (x86)/Arduino\libraries\SpacebrewYun\keywords.txt{{{
syn keyword arduinoFunc SpacebrewYun addPublish addSubscribe connect verbose monitor onMessage send onRangeMessage onStringMessage
syn keyword arduinoFunc onBooleanMessage onCustomMessage onOpen onClose onError
"}}}
"C:/Program Files (x86)/Arduino\libraries\Stepper\keywords.txt{{{
syn keyword arduinoFunc Stepper step setSpeed version direction speed
"}}}
"C:/Program Files (x86)/Arduino\libraries\Temboo\keywords.txt{{{
syn keyword arduinoFunc Temboo TembooChoreo begin setAccountName setAppKeyName setAppKey setChoreo setCredential setSavedInputs addInput
syn keyword arduinoFunc addOutputFilter setSettingsFileToWrite setSettingsFileToRead
"}}}
"C:/Program Files (x86)/Arduino\libraries\TFT\keywords.txt{{{
syn keyword arduinoConstant TFT
syn keyword arduinoFunc EsploraTFT
"}}}
"C:/Program Files (x86)/Arduino\libraries\TFT\src\utility\keywords.txt{{{
syn keyword arduinoFunc Adafruit_GFX Adafruit_ST7735 PImage drawPixel invertDisplay drawLine drawFastVLine drawFastHLine drawRect fillRect
syn keyword arduinoFunc fillScreen drawCircle drawCircleHelper fillCircle fillCircleHelper drawTriangle fillTriangle drawRoundRect fillRoundRect drawBitmap
syn keyword arduinoFunc drawChar setCursor setTextColor setTextSize setTextWrap height width setRotation getRotation newColor
syn keyword arduinoFunc background fill noFill stroke noStroke text textWrap textSize circle point
syn keyword arduinoFunc quad rect triangle loadImage image draw isValid
"}}}
"C:/Program Files (x86)/Arduino\libraries\USBHost\keywords.txt{{{
syn keyword arduinoFunc MouseController USBHost KeyboardController Task mouseMoved mouseDragged mousePressed mouseReleased getXChange getYChange
syn keyword arduinoFunc getButton keyPressed keyReleased getModifiers getKey getOemKey
"}}}
"C:/Program Files (x86)/Arduino\libraries\WiFi\keywords.txt{{{
syn keyword arduinoConstant SSID BSSID RSSI
syn keyword arduinoFunc WiFi WiFiUdp Client Server firmwareVersion status connect write available config
syn keyword arduinoFunc setDNS read flush stop connected begin disconnect macAddress localIP subnetMask
syn keyword arduinoFunSec gatewayIP encryptionType getResult getSocket WiFiClient WiFiServer WiFiUDP beginPacket endPacket parsePacket
syn keyword arduinoFunc remoteIP remotePort
"}}}

syn keyword arduinoStdFunc abs acos asin atan atan2 ceil constrain cos degrees
syn keyword arduinoStdFunc exp floor log map max min radians random randomSeed
syn keyword arduinoStdFunc round sin sq sqrt tan

syn keyword arduinoType boolean byte null String word

hi def link arduinoType Type
hi def link arduinoConstant Constant
hi def link arduinoStdFunc Function
hi def link arduinoFunc Function
hi def link arduinoMethod Function
hi def link arduinoModule Identifier
hi def link arduinoIdentifier Identifier