Vim Tips Wiki


1,614pages on
this wiki

Use this page to discuss script 2654 arduino: syntax file for Arduino .PDE files

  • Add constructive comments, bug reports, or discuss improvements (see the guideline).
  • Do not document the script here (the author should do that on
  • This page may be out of date: check the script's page above, and its release notes.


As of Arduino 1.0 the file extension has changed from .pde to .ino so this line:

autocmd! BufNewFile,BufRead *.pde setlocal ft=arduino

should be:

autocmd! BufNewFile,BufRead *.ino setlocal ft=arduino


This patch fixes the issue with python 2.7.3 and updates the mapping to include keywords up to Arduino 1.6.4

diff johannes-arduino-vim-syntax-8f2d23c9d7be/ arduino-vim-syntax/ 

> 	'Keyboard'   : 'arduinoModule',
> 	'switch'     : 'arduinoMethod',
> 	'break'      : 'arduinoMethod',
> 	'press'      : 'arduinoStdFunc',
< 			print >> sys.stderr ('Warning: No mapping for %s' % str(keywords))
> 			sys.stderr.write('Warning: No mapping for %s\n' % str(keywords))
< 			print >> sys.stderr ('Warning: Collision for %s. Maps to: %s' % (str(keywords), ', '.join(maps_to)))
> 			sys.stderr.write('Warning: Collision for %s. Maps to: %s\n' % (str(keywords), ', '.join(maps_to)))

--May 9, 2015


I am pretty new with the Arduino but did a small amount of programming many years ago so I know a more powerful editor than the Arduino IDE can be a big help. But I'm not advanced enough for the following. A more basic and clear instruction would sure be helpful.

I put the file in the syntax folder, but I don't understand 2 things in the instruction of:

"Just put the file in your vimfiles/syntax folder. To automatically use it on PDE files, add the following line to your vimrc file (or e.g filetype.vim to install it for all users) : "

1. How to place this in the file _vimrc autocmd! BufNewFile,BufRead *.ino setlocal ft=arduino

Do I just open _vimrc and paste it into the first line? I tried that and it wouldn't save as it is a read only file.

The vimrc is a special file that Vim reads, normally from your own home directory, to configure your Vim for your specific usage, desires, and whims. This file does *not* exist by default, you will need to create it, probably using an Example vimrc as a template. You say the file is read-only, which means you probably were editing the default system-wide _vimrc installed by default in Windows. Rather than editing this file, which will be overwritten whenever you install a new Vim version, you should create your own C:\Users\YourUserName\vimfiles\vimrc file and edit that. Incidentally, the first line is probably a bad spot for that line, it should go near the end, probably inside an "augroup". See :help autocmd.txt, especially :help autocmd-define and :help autocmd-groups. --Fritzophrenic (talk) 18:20, June 9, 2015 (UTC)

2. I also do not understand what this means:

 (or e.g filetype.vim to install it for all users) : 

05:25, June 9, 2015 (UTC)~~

This is something you can probably ignore; there is a "filetype.vim" file in your Vim installation directory that is responsible for most of the automatic filetype detection in Vim. But as noted, this will affect all users, and it will also be clobbered whenever you install a new version of Vim. This and more options for filetype detection are detailed in :help new-filetype. --Fritzophrenic (talk) 18:20, June 9, 2015 (UTC)

Would be nice to see an update to this to address any changes to the Arduino API (if any) as Arduino is now version 1.6.1 as of writing. --March 13, 2015‎

Around Wikia's network

Random Wiki