Tutorial: Using Textwrangler instead of the Arduino IDE

Doing some more serious programming I became aware of some shortcomings of the Arduino IDE. What annoyed me most was the fact that it is impossible to customize all keyboard shortcuts. Using a German keyboard layout combinations such as shift+[ are almost impossible to achieve. A question on the forum led to a rather smug answer I should simply edit the source code and compile my own. I won’t.

Besides the lack of customization, code can become pretty confusing when having over 1000 lines to go through to find a certain function. Of course, this has been a problem of many programmers and thus there are already programs that offer good solutions to it. I went for [TextWrangler], a free version of BBedit and so far it helped me a great deal. I can define my own shortcuts for everything, have a dropdown menu of all my functions, can use markers and many more. I still use the Arduino IDE for checking and uploading my code. As far as I know there are ways to set up an automation for Editors like Textwrangler, too, but I haven’t bothered with that yet.

When first opening an Arduino project in TextWrangler, it will look like this:

(click on images for full resolution)

It’s missing all the highlighting of syntax elements such as commands and stuff. This you can change by installing a .plist file that contains all the definitions for the code. I found that one for the Arduino on [Github]. This needs to be put in Textwranglers  “Language Modules” folder. On Mac, you have to right-click on the TextWrangler file in your Programs folder and choose “display contents”. You find your Language Modules folder in there. Windows users better check with the  [TextWrangler] website (sorry).

Once the .plist file is in place you’ll need to (re)start Textwrangler. Then go to TextWrangler->Preferences->Languages and under Custom Extension Mappings associate .ino files with the Arduino language.

When next opening your file, it should look like this:

You can see that there is a dropdown menu with all the functions in the file. You can also minimize and expand those functions for faster scrolling.

You will still need the Arduino ID to upload what you edited. For that you open your file in Arduino. Then in Arduinos Preferences you check “use external editor”. This will make the Arduino code window appear grayish and prevent you from editing the code there. Whenever you upload or check your code now, the Arduino IDE will reload the file automatically and then perform the operation. This means you have to save your TextWrangler file before uploading. But, of course,  you can keep it open all the time.

That’s about it. I hope this was helpful.

Tags: ,

Comments are closed.