1

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?

2 Answers 2

0

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.

0

remove the quotes such as this (tested on Debian):

include /usr/share/nano/sh.nanorc

source: https://askubuntu.com/questions/90013/how-do-i-enable-syntax-highlighting-in-nano#90026

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .