› Syntax Highlighting in Nano 
Tue, 04/10/2007 - 17:14
When I’m messing around with config files on the command line my editor of choice is Nano. It’s simple, fast and pretty much straight forward. You don’t have to learn any commands and can use keyboard shortcuts just like in GUI programs.
Settings
Today I had a look on the project website and saw that there are tons of settings which I really missed before. Just have a look into your /etc/nanorc for a default config file with all settings and their default values. Here are those I like most:
- smooth (scrolling)
- autoindent
- mouse (though I use it rarely)
- smarthome
- tabsize (8 is far to much, I love 4)
Syntax Highlighting
Yes! Nano supports syntax highlighting! And I never knew it, but heck - it’s never to late. Not for neat features like this one, though I really wonder why this is not activated by default…
In the aforementioned /etc/nanorc are already some default languages which just wait to be commented out. You might also want to have a look into /usr/share/nano, there are some languages you can include in your nanorc file with:
include “/usr/share/nano/html.nanorc”
Additionally I found some more languages on the gentoo wiki. And of course I’ll post any homebrew syntax files in my Snippets section.
Comments
Well, two keystrokes, one Sun, 10/18/2009 - 14:16 — Godric (not verified)
Well, two keystrokes, one forth and one back. ;-D
Milian: thx for .ini syntax file. ;-)
I always knew that Nano could Fri, 08/14/2009 - 03:50 — Raven Morris (not verified)
I always knew that Nano could do syntax highlighting, or at least I had heard that it could. I decided to go try it out today, thanks for the article.
@Jon:
You should be using :x instead of :wq … Save yourself one keystroke. :-P
Bloody hell nano supports Tue, 08/04/2009 - 23:44 — Jon (not verified)
Bloody hell nano supports syntax highlighting? Maybe I’ll loathe it a little less on those machines where I’m not allowed to put export EDITOR=vi in root’s .bashrc once I’ve edited that nanorc. I’ll never stop myself hitting :wq though, then growling as I have to go back and delete it before pressing Ctrl X
Post new comment