Nano Nano
I use nano as my primary CLI editor. It may not have as many features as vi(m) or Emacs (in no particular order), it is fast and easy for me.
One of the features that many people do not realize that nano supports is syntax highlighting. This can quickly and easily be enabled by following these directions:
nano will automatically read in ~/.nanorc if it exists. Since you probably don’t have that file there already, go ahead and copy the sample file out of /etc:
[pici@romulus:~]$ cp /etc/nanorc ~/.nanorc
Highlighting for each language needs to be turned on explicitly in your new .nanorc file. In Intrepid, the lines specifying each language begin around line 217, which is probably around the same area in other releases. If not, this is what you’re looking for something similar to this:
some default languages supported by nanorc:
## Nanorc files include "/usr/share/nano/nanorc.nanorc" ## C/C++ include "/usr/share/nano/c.nanorc" ## HTML include "/usr/share/nano/html.nanorc" ## TeX include "/usr/share/nano/tex.nanorc" ## Quoted emails (under e.g. mutt) # include "/usr/share/nano/mutt.nanorc" ## Patch files include "/usr/share/nano/patch.nanorc" ## Manpages include "/usr/share/nano/man.nanorc" ## Groff # include "/usr/share/nano/groff.nanorc" ## Perl include "/usr/share/nano/perl.nanorc" ## Python include "/usr/share/nano/python.nanorc" ## Ruby include "/usr/share/nano/ruby.nanorc" ## Java include "/usr/share/nano/java.nanorc" ## Assembler include "/usr/share/nano/asm.nanorc" ## Bourne shell scripts include "/usr/share/nano/sh.nanorc" ## POV-Ray #include "/usr/share/nano/pov.nanorc"
Go ahead and remove the hash from each include statement for the languages you wish to enable, and you’re all done.
Some other options that I find helpful to have in my .nanorc are as follows:
Other options:
## Setup tabs set autoindent set tabstospaces set tabsize "4" ## Don't wrap text at all. set nowrap
Screenshot coming soon.
Ah! Absolutely brilliant! If only I knew this years ago. :P
other options I myself find usefull:
- set const #to keep track of line numbers
- set regexp #to do _serious_ searches.
- set speller “aspell -l en -x -c” #slightly different from default so it checks in english instead of default system language.
Thank you.
Comment by Pucc — July 28, 2008 @ 2:21 pm
Dude!
I totally have dug nano for ages. I’d be fine with it and no GUI editor. If I had known this existed, I would have added it….and of course I did. Now, how do we go about getting the cobol code highlighting file? :D
Comment by Joseph James Frantz — July 28, 2008 @ 3:25 pm
good site eqftyd
Comment by ok — September 25, 2008 @ 3:07 am