Arduino ino files to be opened with C++ Syntax Highlighting in Sublime Text

Setting Arduino .ino files to open as C++ files in Sublime Text




I have always preferred developing in Sublime Text especially for Arduino Projects since the syntax highlighting is better than doing it in Arduino IDE. Unfortunately, it is annoying to keep opening .ino files on Sublime Text then set the syntax highlighting to C++ (.cpp) on each file.

Luckily, there is a way to do this automatically so that whenever I open a .ino file it will always open with a C++ syntax highlighting in Sublime Text. Below are the steps on how I did it.

Modified version of the Blink code in Arduino IDE
Modified version of the Blink code in Arduino IDE

Note: My Sublime Text is configured to use the Color Scheme named Sixteen.


1. Open a .ino file in Sublime Text

In my case I created an Arduino Sketch, saved it then opened it in Sublime Text. 

By default it will be opened as a Plain Text.




Blink code opened as Plain Text in Sublime Text
Blink code opened as Plain Text in Sublime Text

2. Associate the Arduino file (.ino) as a C++ file (.cpp) in Sublime Text

Go to View >> Syntax >> Open all with current extension as… >> C++.

Once you have selected C++ the window would then convert the syntax highlighting to C++.

Sublime Text C++ Syntax Highlight of the Blink .ino Code
C++ Syntax Highlight of the Blink Code

Now whenever you open an Arduino File (.ino) in Sublime Text it will always open with a C++ Syntax Highlighting.




6 thoughts on “Setting Arduino .ino files to open as C++ files in Sublime Text”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.