Colours in nano

I am writing most of my bash script with nano editor. If one want to get colours in nano, on can do:

[bash]
locate *.nanorc
[/bash]

which will give a list of what is available on your system:
/usr/share/nano/html.nanorc
/usr/share/nano/java.nanorc
/usr/share/nano/man.nanorc
/usr/share/nano/mutt.nanorc
/usr/share/nano/nanorc.nanorc
/usr/share/nano/perl.nanorc
/usr/share/nano/python.nanorc
/usr/share/nano/ruby.nanorc
/usr/share/nano/sh.nanorc

Now, you can do:

[bash]
nano -w ~/.nanorc
[/bash]

and add your prefered styling.

Since I am happy with bash, I would add:
include /usr/share/nano/sh.nanorc
to my file.
Read more here:
http://askubuntu.com/questions/90013/how-do-i-enable-syntax-highlighting-in-nano

See blow how it looks like on my computer:

colours in nano

The text below is what I wrote a couple of years ago, but I keep just in case.

 

Some might remember the editor ‘pico’, today most people know it as ‘nano’.

Have you missed sometime to have colour highlighting when editing bash and php scripts with nano? Here are two interesting projects:

https://github.com/craigbarnes/nanorc

and

https://github.com/alekstorm/nanorc

nano editor with colours

3 comments

  1. I found the tip about running locate *.nanorc and then adding include /usr/share/nano/sh.nanorc to ~/.nanorc genuinely practical, especially for someone who edits bash scripts in nano every day. The follow-up links to the craigbarnes and alekstorm nanorc projects are also useful for anyone who wants broader syntax highlighting without building a config from scratch. For a quick break between terminal sessions, https://scoobydoocreepyrun.com/ is a light browser game that fits the same low-key mood.

  2. I found the walkthrough of enabling syntax highlighting in nano genuinely practical, especially the tip to run locate *.nanorc and then include /usr/share/nano/sh.nanorc in ~/.nanorc. It is a small change, but it makes editing bash scripts far easier to scan, and the linked nanorc projects are a useful follow-up for anyone who wants broader language coverage. For a quick break between terminal sessions, something like https://stuntbikeextreme.org/ offers a bit of motorbike stunt practice.

  3. The practical walkthrough of enabling syntax highlighting in nano is genuinely useful, especially the reminder that a simple locate *.nanorc reveals which language definitions are already installed. I also appreciated the note about adding include /usr/share/nano/sh.nanorc to ~/.nanorc, since that is easy to overlook when configuring the editor. The older section about alternative nanorc projects still feels relevant for anyone who wants broader highlighting support. For a different kind of hands-on challenge, https://soflowheelielife.com/ offers a wheelie game with realistic physics.

Leave a Reply

Your email address will not be published. Required fields are marked *