It is currently Wed Jun 19, 2013 10:56 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: HOWTO: Nano, my favorite editor
PostPosted: Sun Dec 28, 2008 6:50 pm 
Regular Zenwalker
Regular Zenwalker

Joined: Sun Dec 14, 2008 2:29 pm
Posts: 85
Location: Panama
I couldn't program myself out of a paper bag; Vim gives me a headache
and can't use it without a cheat sheet, and yet, i can't live without
vimperator (the addon for iceweasel) whose keybindings are vim's
exclusively, so go figure. For my basic needs nano is the app for me, i
use it to edit my files and as a word processor. If you need more
complex options for programming, etc, there is vim, emacs, joe, jed, you
name it. If you're an average sinner like me, nano is enough :)

INSTALLATION
# netpkg nano

$ man nanorc

will give you a list of the options in order for nano to behave
according to your needs. After you're thru reading, create the file
.nanorc (it will be blank).

$ nano .nanorc

and paste the options that best suit you your needs:

set or unset <option>

These are the ones i included:
Code:
set const
set smooth
set mouse
set tabsize 3
set fill 72

set const
gives you the line in the file you are at the moment as you move up or
down live. It appears at the bottom.

set smooth
eliminates the jerky half page move that nano does by default.

set mouse
allows you to put the mouse cursor where you want it, requires the
installation of 'gpm'. Just press the mouse left button where you want
the cursor.

set tabsize 3
when you press TAB it moves 3 spaces

set fill 72
wraps at 72 columns, when writing a paper or using nano as a
word processor (my case).

WARNING:
It's very important if you have this option in your .nanorc to launch
nano with the -w flag for EDITING REGULAR FILES, it disables the wrap,
otherwise, you might run into trouble.

If you don't like the 'help' cheat list at the bottom of nano because
you know them by heart, or it steals real estate, use the 'x' flag . So, when editing regular
files, you can disable the wordwrap and the help cheat list:

# nano -wx <file name>

F7 -takes you to the first line of the file. Press it till you get there
or if you have the Fn keys assigned to something else, press Ctrl+Y

F8 - takes you to the last line of the file, press it till you get
there or Ctrl+V

F9 - cuts (deletes) the line.
or you can use Ctrl+K

F10 - it undoes the line deleted (puts it back)
or Ctrl+U

To copy/paste, highlight the content you want copied, and to paste it,
put the cursor where you want it and press Shift+middle mouse button.

WORD PROCESSOR
My needs for a word processor are pretty basic, i need something fast,
and not complex, i am a little dense, i save what i write in .txt format
so anybody i send it to can open it regardless of the OS they're using.


** NOTICE
The following keybindings eventhough are written in caps for clearer
reading are to be used without the caps.

To format the paragraph: Ctrl+J
To erase the help options at the bottom: Alt+X, to bring it back...do
the same.

To format the whole file: Alt+J
To get the number of words, lines and characters: Alt+D

To go to the beginning of the line: Ctrl+A

To go to the end of the line: Ctrl+E

After you finish editing a file, save and exit:
Ctrl+O saves the file
Ctrl+X exits nano

EDITING
If the file you're editing is in your /home, you own it, you can do this
as user, for example:

$ nano -w .xinitrc

Any other file you have to be root, for example:
# nano -w /etc/lilo.conf

And a bunch more, ^G (that's Ctrl+G in geek speak) will give you more
info, about spaces, lines, going forward, backwards, you name it.

You can copy/paste your writings from nano or open it from your browser,
just put in the address bar where it is, for example:
/home/macondo/nano.txt (in this case), copy it (Ctrl+a) from the browser
screen, and paste it (Ctrl+v) voilà! the howto is pasted.

Feel free to correct any mistakes or add more tips to this howto.

Happy editing :)

This article was written with gnu-nano

Lou aka macondo,limpio
28 Dec 2008

_________________
Sempron 2600 (1.6 Mhz) || 512 MB RAM DDR || SATA 80 GB
ZW 5.4 Beta || IceWM || Ratpoison || Vimperator
KISS Protocol: Keep It Simple, Stupid


Last edited by Lou on Mon Jan 12, 2009 3:00 pm, edited 1 time in total.

 Profile Send private message  
 
 Post subject: Re: HOWTO: Nano, my favorite editor
PostPosted: Mon Dec 29, 2008 10:56 pm 
Master Zenwalker
Master Zenwalker
User avatar

Joined: Fri May 05, 2006 1:36 am
Posts: 564
Location: that and other Universes
i love nano. good job.
yo amo nano. buen trabajo.

_________________
!!!Linux is like a Wigwam, no Gates, no Windows and an Apache inside!!!


 Profile Send private message  
 
 Post subject: Re: HOWTO: Nano, my favorite editor
PostPosted: Tue Dec 30, 2008 12:29 am 
Zenwalk Packager
Zenwalk Packager

Joined: Wed Mar 29, 2006 7:33 am
Posts: 1580
Location: Bicester, Oxfordshire, UK
Nano is also able to use syntax highlighting for a number of different types of files. If you look in /usr/share/nano you will find a number of samples for nanorc use.

To include syntax highlighting for (as an example) html, do this:

Code:
cat /usr/share/nano/html.nanorc >> ~/.nanorc


Other options from the examples in /usr/share/nano can be included in the same way, just making sure that you use >> so that your original .nanorc is not overwritten.

In some instance, other packages also include samples for syntax highlighting for nano. For example, if you have Conky installed, you can have a look in /usr/doc/conky-1.6.1/extras/nano for a sample to add conky-aware syntax highlighting to nano.

paul.

_________________
ThinkZen member #001
Proud Thinkpad Zenwalker


 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


 Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
 
cron