Although newer versions of Ubuntu (10.04 and up) already come with the helpful nano syntax highlighting enabled, older versions don’t – though thankfully switching this on is pretty simple to achieve.

To enable nano syntax highlighting for a user, first copy the nanorc file to the users home directory:

cp /etc/nanorc ~/.nanorc

Next, edit the file, scrolling down to the bottom of the file and uncommenting the lines for the languages you wish to turn syntax highlighting on for.

nano ~/.nanorc

Save your changes and fire up nano against a file with a recognised language extension to see the colorful result.

Easy peasy :)