I am a huge fan of the nano editor, but I can’t get the syntax highlighting to work in the windows version. Is it possible to have syntax highlighting in windows?
The selected answer by James Baxter is incorrect.
In order to enable syntax highlighting for
nano in Cygwin, you will need to create
~/.nanorc, which is the file that
nano looks for when loading syntax highlighting.
In this file you should include whatever
include statements containing paths to the syntax highlighting files, which are usually located in
The contents of my
The easiest way to do this is a simple one-liner:
ls -1 /usr/share/nano | sed 's@^@include /usr/share/nano/@' > ~/.nanorc
/usr/share/nano does not already contain any
.nanorc files, just download them from the Git repo.
The issue is that nobody tell you that the native Windows API version of Nano, require you to use
POSIX paths for the syntax highlighter files
*.nanorc in your include statement in
C:Users<username>.nanorc and make sure the import lines reads something like this:
#include "C:nanonanorc*.nanorc" # Windows paths does NOT work! include "/nano/nanorc/*.nanorc" # This works!