Hardware Hacking in Vim

October, 2011

We love our hardware hacking here at GitHub and with the recent upgrade in space at the new office we’ve been holding weekly hardware hacking workshops with the illustrious Matt Ganucheau. In those sessions the crew has been messing with sensors and actuators, bots and quad copter drones, mesh networks and octocat powered kinects…

We are huge fans of the Arduino stack which is hosted on GitHub, and there are dozens of Arduino boards running around the office. The beauty of writing code for the Arduino is that you rarely end up writing a lot of it and once you’ve written a sketch, it runs on a whole variety of compatible boards. Compared to how microcontroller prototyping was done 5 years ago, this is a serious breath of fresh air. There are some of us, however, who would rather continue to write code in vi (MacVim in my case), so I came up with a nice hack…

Enter vim-arduino.

This is my first attempt at getting Arduino IDE functionality into MacVim. Right now you can compile, deploy and open a serial port. The board for deployment always defaults to ‘uno’, but you can override that by putting the name of the board  on the first line of your sketch like so (any board found in boards.txt is valid):

// board: atmega328

Compiling code can be done like so:


Compiling and the deploying is done like so:


You can also open a serial port for debugging like this:


The goal here is to be 100% compatible with existing Arduino sketches and to take advantage of the rest of the Arduino environment. Your hardware hacking peers should never know you are secretly rocking vi.

Checkout the README to get things setup and bug me on Twitter if you find any of this useful.

Tim's Avatar Hi, I'm Tim Clem. I'm an engineer at GitHub in San Francisco, currently focused on applied programming language theory.