Nanorc

#1

Saw a neat video on a package that is in the AUR called nano-syntax-highlighting (baph -s nano-syntax-highlighting).

You can install via the git page or if you are like me and want to have a bit more control on what you want in your nanorc file, install from the AUR and follow the manual process outlined on the git.

It’s a really nice addition to nano (if you use it of course) but in a nutshell, there are neat little additions for a crap-load of programming languages and some other items (for me, I love the i3 config addition).

Just a little something that adds a bit more flare to your AL experience.

UPDATED: I wanted to show you a short snippet of the tail end of my nanorc file so you can see what the manual process might look like in addition to what the i3 addition looks like :slight_smile:

## Key bindings.
## See nanorc(5) (section REBINDING KEYS) for more details on this.
##
## The following two functions are not bound to any key by default.
## You may wish to choose other keys than the ones suggested here.
# bind M-B cutwordleft main
# bind M-N cutwordright main

## Set this if your Backspace key sends Del most of the time.
# bind Del backspace all

# Additions
include "/usr/share/nano-syntax-highlighting/i3.nanorc"
include "/usr/share/nano-syntax-highlighting/etc-hosts.nanorc"
include "/usr/share/nano-syntax-highlighting/mutt.nanorc"
include "/usr/share/nano-syntax-highlighting/mpdconf.nanorc"
include "/usr/share/nano-syntax-highlighting/python.nanorc"
include "/usr/share/nano-syntax-highlighting/sed.nanorc"
include "/usr/share/nano-syntax-highlighting/systemd.nanorc"
include "/usr/share/nano-syntax-highlighting/xresources.nanorc"
include "/usr/share/nano-syntax-highlighting/man.nanorc"
include "/usr/share/nano-syntax-highlighting/awk.nanorc"
include "/usr/share/nano-syntax-highlighting/conf.nanorc"

Cheers!

8 Likes

#2

Going to check this out right away, thanks for the tip!

0 Likes

#3

Thanks @Chris !

0 Likes

#4

Nano already has this as an option, although this package looks to have more syntax highlighting than what the default nano install has. But you can do it manually and pick what syntax highlighting you want from the packages github.

You can set it up by doing the following.

mkdir -p ~/.config/nano
cp -r /etc/nanorc ~/.config/nano/

Then un comment line 262 include "/usr/share/nano/*.nanorc"

If you use nano for a lot of root text editing do the same in /etc/nanorc as well

As well as that have a read in nanorc from line 201 here you can paint how root and user looks when using nano, so you uncomment the colors for root in etc/nanorc and then uncomment the colors for user in .config/nano/nanorc

Below is what archlinux ships in regards to syntax highlighting and you can download from the AUR package github what syntax you want and add it to /usr/share/nano

autoconf.nanorc   go.nanorc          mutt.nanorc      pov.nanorc
awk.nanorc        groff.nanorc       nanohelp.nanorc  python.nanorc
changelog.nanorc  guile.nanorc       nanorc.nanorc    ruby.nanorc
cmake.nanorc      html.nanorc        nftables.nanorc  rust.nanorc
c.nanorc          java.nanorc        objc.nanorc      sh.nanorc
css.nanorc        javascript.nanorc  ocaml.nanorc     spec.nanorc
debian.nanorc     json.nanorc        patch.nanorc     tcl.nanorc
default.nanorc    lua.nanorc         perl.nanorc      texinfo.nanorc
elisp.nanorc      makefile.nanorc    php.nanorc       tex.nanorc
fortran.nanorc    man.nanorc         po.nanorc        xml.nanorc```
1 Like