vigna / ne

ne, the nice editor
http://ne.di.unimi.it/
GNU General Public License v3.0
473 stars 33 forks source link

Request: syntax highlight for Arduino #70

Closed bbailleux closed 4 years ago

bbailleux commented 4 years ago

Hello, It would be great if source code files for Arduino would be highlighted like the C/C++ language. Those files commonly use the ".ino" extension and use a subset of C/C++ language.

utoddl commented 4 years ago

Thanks for trying ne, @bbailleux . I'm glad to say, you have all the tools in hand to accomplish what you want. Here's a step-by-step procedure.

  1. Open a new or existing .ino file: ne HelloWorld.ino

  2. Set any preferences you want ("FreeForm", "TabSize", "AutoInsert", etc.) for .ino files, including "Syntax". From the command line (^K), enter "Syntax c++". Note than ne doesn't have an explicit c++.jsf syntax recognizer. Rather it internally maps a set of common extensions (c++, cc, cpp, cxx, h, h++, hpp, l, lex, y, yacc) to "c", and the c.jsf is used for both c and c++. You can see the table of built-in extension maps in the help text for the Syntax command. ("^k help syntax").

  3. Save these preferences for .ino files -- which will include your preferred syntax recognizer -- with the "SaveAutoPrefs" command. From the command line, that's "SaveAutoPrefs" or "SAP" for short, or from the "Prefs" menu, 2nd item from the bottom. That will save the file .ne/ino#ap which contains all the current preferences.

From now on, any time you open a .ino file, .ne/ino#ap will be consulted automatically and all the preferences therein will be set. It's just a plain text file containing a set of ne commands. Feel free to edit it, even to throw out any preferences you don't want to be automatically set when .ino files are loaded.

I'm closing this request, but you're welcome to come over to http://groups.google.com/group/niceeditor/ to discus this or other issues or questions as they come up.

brasofilo commented 4 years ago

Great, this worked perfectly to highlight .bash_aliases files. Thanks for this awesome editor, Todd!