Syntax highlighting in nano

Enable syntax highlighting in nano! Find out how to configure the .nanorc file step by step to enjoy readable code in your favorite editor.

If, while writing web pages or programs, we use the nano editor, it's worth enabling syntax highlighting. To do this we need to create the configuration file .nanorc in our directory. An example of this file, depending on how nano was compiled, should be found in the directory /usr/doc/nano/nanorc.sample. Then we copy this file by issuing the command cat /usr/doc/nano/nanorc.sample >~/.nanorc The last step is editing the file, looking in it for the appropriate entry - for example, if we want to write in C/C++, we remove the hash from the line: #include "/usr/share/nano/c.nanorc".