Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am running Debian and I would like to turn on syntax highlighting for nano. My system has predefined syntax definitions...

standage@idebian:~$ ls /usr/share/nano/
asm.nanorc    c.nanorc       fortran.nanorc  html.nanorc      man.nanorc     nanorc.nanorc  patch.nanorc  pov.nanorc     sh.nanorc   xml.nanorc
awk.nanorc    css.nanorc     gentoo.nanorc   java.nanorc      mutt.nanorc    objc.nanorc    perl.nanorc   python.nanorc  tcl.nanorc
cmake.nanorc  debian.nanorc  groff.nanorc    makefile.nanorc  nano-menu.xpm  ocaml.nanorc   php.nanorc    ruby.nanorc    tex.nanorc

...and I have included all of these in my ~/.nanorc file.

standage@idebian:~$ head /home/standage/.nanorc 
include "/usr/share/nano/asm.nanorc"
include "/usr/share/nano/awk.nanorc"
include "/usr/share/nano/cmake.nanorc"
include "/usr/share/nano/c.nanorc"
include "/usr/share/nano/css.nanorc"
include "/usr/share/nano/debian.nanorc"
include "/usr/share/nano/fortran.nanorc"
include "/usr/share/nano/gentoo.nanorc"
include "/usr/share/nano/groff.nanorc"
include "/usr/share/nano/html.nanorc"

However, I get no syntax highlighting when I open code files with typical file extensions (.c, .h, etc). What's odd is that when I opened the .nanorc file to check it, the syntax highlighting was activated.

Am I doing something wrong?

share|improve this question

1 Answer 1

My guess is that something is wrong with your ~/.nanorc (syntax, line endings or something) since you get correct hilighting for *.nanorc that is globally enabled by default in /etc/nanorc.

Try adding just a single include (e.g. include "/usr/share/nano/c.nanorc") to /etc/nanorc and see what happens.

Edit: well, it is rather strange, but the order of includes seems to have matter too... At a glance, everything works when *.nanorc files are included in alphabetical order.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.