Configure external editor to build/upload and capture file/line on errors

One of the major pet-peeves of Arduino IDE is the inability to capture file/line of the compilation error and then get to that location with click. This feature is standard in IDEs in this century. I am going to show you how to setup external editor for compiling Arduino project and capturing compilation output.

Will use the ability of Arduino IDE to be invoked from command line and perform rebuild (they call it verify) and upload: Arduino/manpage.adoc at master · arduino/Arduino · GitHub

If you read instructions in manpage above carefully, you know that on Windows you have to call arduino_debug.exe instead of arduino.exe. Also I like that we can change build directory, so generated hex files can be added to version control. In the commands below I am configuring output to sketch subdirectory output by --pref build.path=$(FileDir)/output

You need text editor that is customizable. My favorite editor is SciTE: , On Windows I always use the installer with extensions as it integrates into Windows Explorer. The settings of this editor is in key=value format

Go to menu Options → Open User Options and add at the end:

filter.ino=Arduino (ino)|$(file.patterns.ino)|

command.compile.*.ino="c:\Program Files (x86)\Arduino\arduino_debug.exe" --verify --board arduino:avr:nano:cpu=atmega328 --pref "build.path=$(FileDir)/output" "$(FilePath)"*.ino="c:\Program Files (x86)\Arduino\arduino_debug.exe" --verify --board arduino:avr:nano:cpu=atmega328 --pref "build.path=$(FileDir)/output" "$(FilePath)"
command.go.*.ino="c:\Program Files (x86)\Arduino\arduino_debug.exe" --upload --board arduino:avr:nano:cpu=atmega328 --pref "build.path=$(FileDir)/output" "$(FilePath)"

You can override any options seen in Global Options. I also like to set:

font.base=font:DejaVu Sans Mono,size:10
font.comment=font:DejaVu Sans Mono,size:10
font.text=font:DejaVu Sans Mono,size:10
font.embedded.base=font:DejaVu Sans Mono,size:10
font.embedded.comment=font:DejaVu Sans Mono,size:10
font.monospace=font:DejaVu Sans Mono,size:10

Save and restart SciTE to reload new settings. Now when you open Arduino sketch in SciTE, it will be syntax highligted and Tools → Compile and Tools → Build are now available and will invoke Arduino rebuild and all standard output is captured in output pane and SciTE is smart enough to understand them and click gets you to source file.

Tools → Go will upload to the target.

If you need to use different board than board you setup in, then create in sketch directory and copy last 3 lines starting with “command.” and modify to your needs. Now next time you open the sketch in this directory, these local settings will override default ones. Another nice thing about local properties is that you can edit it by Options → Open Local Options and unlike global options this one gets reloaded before Tools → Build.

I use Linux and I use the Geany editor coupled with a short Python compile and upload program to get somewhat similar capability.

I originally wrote the Python program so it would automatically add the name of the file as "Serial.print..." line in the Arduino program so that, when I later run the Arduino program I can identify the exact code that was used to produce it.

I may investigate to see if the extra features you have can be incorporated.