Apache conf file syntax coloring for nano

I’m gonna lose all 1337 h4x0r rep my admitting that my fav editor is Nano. This is a remnant of using Pine as my preferred email program in college (and even today when I can only get in via SSH), which by default uses Pico as its editor. Nano is a Pico clone that has a “free as in freedom” license in the GPL, and adds some enhancements like regex searching and syntax coloring.

Yesterday I decided to delve back into developing syntax coloring stuff for Nano on our servers, and came up with a pretty decent setup for Apache conf files. It includes special coloring for the runtime config directives.

To use this, make a text file in your home directory called .nanorc and paste the contents of this file into it:


  • Nigel
    06/30/2006 10:26:38 AM

    What other nano syntax files have you developed? I’ve not seen many on the net and yours is one of the first I found but its damn useful!

  • Ed
    06/30/2006 11:37:16 AM

    I’ve done a few things here and there, but only for my own use. I prefer to do coding in a GUI editor, but I’m almost always editing apache conf files in the shell, so having syntax coloring for those files makes more of an impact in my productivity than it would for other file types.

  • Mikel King
    03/27/2009 09:52:43 AM

    Thanks for putting this together.

    I’ve found it’s a good idea to drop these syntax highlighters into their own repositories, wither as a system global or at least in my own personal which is referenced from my .nanorc

    as an example…

    ## Nanorc files
     include "/usr/local/share/nano/c.nanorc"
    ## Apache Configuration Files
     include "~/.nanorc.d/apache.nanorc"

    Still great work thanks!!!


  • funkatron
    03/27/2009 10:42:18 AM

    Very good idea, Mikel. Thanks!