« My most useful scripts... so far | Main | Symbols in matplotlib »

Syntax Highlighting in Nano

Being an astronomer my life at work quite often involves me using a commandline text editor. I'm a big fan of nano/pico and overwhelming prefer them to vi (I know this topic is easy the start a flame war - I'm just not one for vi, never could remember the commands etc). Now today my other half (being the geek that she is) wondered if I knew how todo syntax highlighting in nano since vi by default on her system does this and people were suggesting she did that. Me, I'm not one for syntax highlighting on the commandline (if I want that I just open up gedit/emacs)... but I thought this would be interesting to see if nano can, and indeed it can... so here is simply how to do it:

Put the following into ~/.nanorc

# Colour setup
include "/usr/share/nano/asm.nanorc" # Assembler
include "/usr/share/nano/sh.nanorc" # Bourne shell scripts
include "/usr/share/nano/c.nanorc" #C/C++
include "/usr/share/nano/groff.nanorc" # Groff
include "/usr/share/nano/html.nanorc" #HTML
include "/usr/share/nano/java.nanorc" # Java
include "/usr/share/nano/man.nanorc" # Manpages
include "/usr/share/nano/nanorc.nanorc" #Nanorc
include "/usr/share/nano/perl.nanorc" # Perl
include "/usr/share/nano/python.nanorc" # Python
include "/usr/share/nano/ruby.nanorc"# Ruby
include "/usr/share/nano/tex.nanorc" # TeX

and it is that simple!

Oh and some other useful settings to include:

set mouse # Enable mouse support, i.e. set the marker!
set boldtext

TrackBack

TrackBack URL for this entry:
http://www.krioma.net/cgi-bin/mt_new/mt-tb.cgi/460

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About

This page contains a single entry from the blog posted on September 2, 2010 4:15 AM.

The previous post in this blog was My most useful scripts... so far.

The next post in this blog is Symbols in matplotlib.

Many more can be found on the main index page or by looking through the archives.

Get Firefox! Valid XHTML 1.0! Valid CSS! RSS Feed BlogUniverse - listed Powered by Apache Creative Commons License ringsofsaturnrock's Most Interesting Photos on Flickriver

Powered by
Movable Type 3.33