How to Enable Sintax Highlighting in Nano
Nano is a lightweight and user-friendly text editor for UNIX and UNIX-like systems. Although it runs from the command-line it’s really easy to use and the first choice for those who want to edit a text file and don’t need any advanced feature found on a graphical editor.
Nano has syntax highlighting support for many programming languages like C, Python, Perl or HTML, but it’s disabled by default. The highlighting definitions for the supported languages are kept in the /usr/share/nano directory. To see wich definitions are installed on your system use ls:
$ ls /usr/share/ nanoasm.nanorc html.nanorc nano-menu.xpm pov.nanorc tex.nanorc c.nanorc java.nanorc nanorc.nanorc python.nanorc man.nanorc patch.nanorc ruby.nanorc groff.nanorc mutt.nanorc perl.nanorc sh.nanorc
To enable syntax highlighting for any of those languages you need to edit the ~/.nanorc file with your favorite editor (nano ~/.nanorc) and add lines like this:
include "/usr/share/nano/c.nanorc" include "/usr/share/nano/html.nanorc" include "/usr/share/nano/ruby.nanorc"
That will enable syntax highlighting for C, HTML and RUBY. Now nano should look like this:

0 comments
