How do I get this to work, I did add the color syntax highlighting configuration in nano.rc and .nanorc, but nothing happen.
The previous answer is outdated and also wrong.
Most of the problem with the coloring is due to the fact that the native build windows version doesn't support windows paths, as it's using GNU's glob(). So you need to use forward POSIX style paths in your syntax include statement in the .nanorc
file.
Here is the entire install procedure:
Download the latest syntax highlighter files *.nanorc
from here
Chose an installation location. For example in C:\nano\
.
Extract the contents into that directory and move it around so that you have:
C:\nano\bin\ # For the nano.exe
C:\nano\nanorc\ # For all the *.nanorc files
C:\nano\doc\ # For the documentation files
Put the .nanorc
into your home directory in: C:\Users\<username>\.nanorc
.
Add the nano file paths to your System Path
:
# To set and update the Windows (System) "Path" in Powershell, use:
[System.Environment]::SetEnvironmentVariable("PATH", $Env:Path + ";C:\nano\bin", "Machine")
Reboot, restart explorer, or install refreshenv
from choco.
Optional
: Run nano once, to ensure that a filepos_history
file is created.
You probably want to be able to run Nano with both normal or Administrator privileges, but not having to keep track of more edit locations and 2nd config files. To do this, you need to symlink your own versions of the nano config and history setting files, to the admin versions.
# Link last cursor position files:
New-Item -ItemType SymbolicLink -Path "C:\ProgramData\.local\share\nano\filepos_history" -Target "C:\Users\<username>\.local\share\nano\filepos_history" -Force
# Link .nanorc files:
New-Item -ItemType SymbolicLink -Path "C:\ProgramData\.nanorc" -Target "C:\Users\<username>\.nanorc" -Force
.nanorc
to include the correct POSIX
paths to all your *.nanorc
files.# Why not use nano to edit your .nanorc
cd ~
nano .nanorc
# Add the following line(s):
#include "C:\nano\nanorc\*.nanorc" # Windows paths does NOT work!
include "/nano/nanorc/*.nanorc" # This works!
Enjoy!