Skip to content

Commit 981eee5

Browse files
committed
Initial syntax file generated using Arduino 1.0.3
1 parent b313ca7 commit 981eee5

File tree

3 files changed

+98
-1
lines changed

3 files changed

+98
-1
lines changed

README.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,40 @@
11
vim-arduino-syntax
22
==================
33

4-
Arduino syntax files for Vim
4+
Love Arduino and Vim? Then use this syntax file and get syntax highlighting for Arduino functions in vim.
5+
6+
Installation
7+
============
8+
9+
Manual
10+
------
11+
- Copy `syntax/arduino.vim` file into your `~/.vim/syntax` directory
12+
- Copy `ftdetect/arduino.vim` file into your `~/.vim/ftdetect` directory
13+
14+
Using [Vundle](https://github.com/gmarik/vundle)
15+
-------------
16+
17+
```VimL
18+
19+
Bundle "sudar/vim-arduino-syntax"
20+
21+
And :BundleInstall
22+
23+
```
24+
Credit
25+
======
26+
27+
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.
28+
29+
Contributions
30+
================
31+
32+
Contributions are always welcome in the form of pull requests with explanatory comments.
33+
34+
Other tools for Arduino and Vim
35+
===========================
36+
37+
If you are using Arduino with Vim, then also checkout some of my other projects.
38+
39+
- [Arduino snippets for Vim](https://github.com/sudar/vim-wordpress-snippets)
40+
- [Arduino Make file](https://github.com/sudar/Arduino-Makefile)

ftdetect/arduino.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
au BufRead,BufNewFile *.ino,*.pde set filetype=arduino

syntax/arduino.vim

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
" Vim syntax file
2+
" Language: Arduino
3+
" Maintainer: Sudar <sudar@sudarmuthu.com>
4+
" Original Author: Johannes Hoff <johannes@johanneshoff.com>
5+
" Last Change: 19 February 2013
6+
" License: VIM license (:help license, replace vim by arduino.vim)
7+
8+
" Syntax highlighting like in the Arduino IDE
9+
" Automatically generated by the script available at
10+
" https://bitbucket.org/johannes/arduino-vim-syntax
11+
" Using keywords from <arduino>/lib/keywords.txt
12+
" From version:
13+
14+
" Thanks to original author Johannes Hoff and Rik, Erik Nomitch, Adam Obeng and Graeme Cross for helpful feedback!
15+
16+
" For version 5.x: Clear all syntax items
17+
" For version 6.x: Quit when a syntax file was already loaded
18+
if version < 600
19+
syntax clear
20+
elseif exists("b:current_syntax")
21+
finish
22+
endif
23+
24+
" Read the C syntax to start with
25+
if version < 600
26+
so <sfile>:p:h/cpp.vim
27+
else
28+
runtime! syntax/cpp.vim
29+
endif
30+
31+
syn keyword arduinoConstant BIN CHANGE DEC DEFAULT EXTERNAL FALLING HALF_PI HEX
32+
syn keyword arduinoConstant HIGH INPUT INPUT_PULLUP INTERNAL INTERNAL1V1
33+
syn keyword arduinoConstant INTERNAL2V56 LOW LSBFIRST MSBFIRST OCT OUTPUT PI
34+
syn keyword arduinoConstant RISING TWO_PI
35+
36+
syn keyword arduinoFunc analogRead analogReference analogWrite
37+
syn keyword arduinoFunc attachInterrupt bit bitClear bitRead bitSet
38+
syn keyword arduinoFunc bitWrite delay delayMicroseconds detachInterrupt
39+
syn keyword arduinoFunc digitalRead digitalWrite highByte interrupts
40+
syn keyword arduinoFunc lowByte micros millis noInterrupts noTone pinMode
41+
syn keyword arduinoFunc pulseIn shiftIn shiftOut tone
42+
43+
syn keyword arduinoMethod available begin end find findUntil flush loop
44+
syn keyword arduinoMethod parseFloat parseInt peek print println read
45+
syn keyword arduinoMethod readBytes readBytesUntil setTimeout setup
46+
47+
syn keyword arduinoModule Serial Serial1 Serial2 Serial3
48+
49+
syn keyword arduinoStdFunc abs acos asin atan atan2 ceil constrain cos degrees
50+
syn keyword arduinoStdFunc exp floor log map max min radians random randomSeed
51+
syn keyword arduinoStdFunc round sin sq sqrt tan
52+
53+
syn keyword arduinoType boolean byte null String word
54+
55+
hi def link arduinoType Type
56+
hi def link arduinoConstant Constant
57+
hi def link arduinoStdFunc Function
58+
hi def link arduinoFunc Function
59+
hi def link arduinoMethod Function
60+
hi def link arduinoModule Identifier

0 commit comments

Comments
 (0)