Nano syntax highlighting

I wanted to share an easy way of adding syntax highlighting to your favorite editor. I’ll give you examples to use for Arch Linux, RHEL, CentOS, Fedora and Debian. This all requires you to add code to your ~/.nanorc file. Luckily, the nano packages contain what you want. You just have to add it.

The typical format of these nanorc files that comes with the nano package is programming_language.nanorc.

To list the available packages for each distributions please do the following

RHEL/CentOS/Scientific Linux/Fedora

# rpm -ql nano | grep nanorc

Debian

# dpkg -S nano | grep nanorc

Arch Linux

# pacman -Ql nano

They all reside in the /usr/share/nano/ folder on each system.

You add languages to your ~/.nanorc the following way.

$ cat /usr/share/nano/programming_language.nanorc >> ~/.nanorc

The >> option will append information so you can keep using this command for each language you want to add syntax highlighting for.

// CrashMAG