Tools

Syntax highlighting with nano

Ok, I will be the first to admit that this is nothing new, however I just found out it about today! It seems that all this time I have been using for my default linux editor, completely unaware that it has the capacity for syntax highlighting. (DOH!)

It seems that with a simple file you can set the highlighting colors for just about any kind of file. I found a very good example at http://osx.hyperjeff.net/MyApps/nanorc, although the Python highlighting he has uncommented has a mal-formed regex in the first line. (I just deleted that one and uncommented the one above and it works great.)

There are two examples at the bottom of the page at http://article.gmane.org/gmane.linux.gentoo.user.german/9565 – the page is in German but the .nanorc files are there. The first is for use with a black screen, the second for use with a white screen. (The hint here is don’t use black on a black screen or brightwhite on a white screen, and brightyellow is unreadable on a white screen as well.)

There are enough examples to get you started, and it shouldn’t be too difficult to come up with your own color schemes that fit the way you work best.