Enable syntax highlighting for Nano on Debian or Ubuntu

Nano is a simple editor for editing files in a terminal. It’s limited functionality makes it my personal favorite for quickly editing configuration files. To enable syntax highlighting, which is disabled by default, run the following commands:

mkdir ~/.nano
wget "http://wiki.ubuntuusers.de/_attachment?target=Nano/highlighterliste" --quiet -O - | while read prefix; do
wget "http://wiki.ubuntuusers.de/_attachment?target=Nano/$prefix.nanorc" --quiet -O ~/.nano/$prefix.nanorc; done
wget "http://wiki.ubuntuusers.de/_attachment?target=Nano/.nanorc" -O ~/.nanorc

Nano will now highlight the syntax of files with a known file extension such as .html. What’s still missing is a default setting for unknown or missing extensions. Open ~/.nanorc and uncomment the last line so that it looks like this:

include "~/.nano/default.nanorc"

There you go, have fun. If you need more information, check out this page: http://wiki.ubuntuusers.de/Nano.

/content/images/2015/10/nano.png