nano.texi 15.6 KB
Newer Older
Chris Allegretta's avatar
Chris Allegretta committed
1
2
3
4
5
6
7
8
9
10
\input texinfo  @c -*-texinfo-*-
@c %**start of header
@setfilename nano.info
@settitle nano Command Manual
@c %**end of header

@c This file has the new style title page commands.
@c Run `makeinfo' rather than `texinfo-format-buffer'.
@smallbook
@set EDITION 0.1
Chris Allegretta's avatar
Chris Allegretta committed
11
@set VERSION 1.1.9
Chris Allegretta's avatar
Chris Allegretta committed
12
@set UPDATED 14 Jul 2002
Chris Allegretta's avatar
Chris Allegretta committed
13

14
15
@dircategory Editors
@direntry
Chris Allegretta's avatar
Chris Allegretta committed
16
* nano: (nano).                 Small and friendly text editor.
17
@end direntry
Chris Allegretta's avatar
Chris Allegretta committed
18
19
20
21
22
23

@c tex
@c \overfullrule=0pt
@c end tex

@titlepage
24
@title GNU @code{nano}
Chris Allegretta's avatar
Chris Allegretta committed
25
@subtitle a small and friendly text editor.
Chris Allegretta's avatar
Chris Allegretta committed
26
@subtitle version 1.1.9
Chris Allegretta's avatar
Chris Allegretta committed
27
28
29
30

@author Chris Allegretta
@page

31
32
This manual documents GNU @code{nano}, a small and friendly text
editor.
Chris Allegretta's avatar
Chris Allegretta committed
33

34
This manual is part of the GNU @code{nano} distribution.@*
Chris Allegretta's avatar
Chris Allegretta committed
35
@sp4
36
Copyright (C) 1999, 2000, 2001, 2002 Chris Allegretta.
Chris Allegretta's avatar
Chris Allegretta committed
37

Chris Allegretta's avatar
Chris Allegretta committed
38
39
40
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Chris Allegretta's avatar
Chris Allegretta committed
41
42
43

@iftex
Permission is granted to process this file through TeX and print the
Chris Allegretta's avatar
Chris Allegretta committed
44
45
46
results, provided the printed document carries copying permission notice
identical to this one except for the removal of this paragraph (this
paragraph not being relevant to the printed manual).
Chris Allegretta's avatar
Chris Allegretta committed
47
48
49
@end iftex

Permission is granted to copy and distribute modified versions of this
Chris Allegretta's avatar
Chris Allegretta committed
50
51
52
manual under the conditions for verbatim copying, provided that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
Chris Allegretta's avatar
Chris Allegretta committed
53
54
55

Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions,
Chris Allegretta's avatar
Chris Allegretta committed
56
57
except that this permission notice may be stated in a translation
approved by the Foundation.
Chris Allegretta's avatar
Chris Allegretta committed
58
59
60
61
62
63
64

You may contact the author by:
e-mail: @email{chrisa@@asty.org}@*
@end titlepage

@node Top, Introduction, (dir), (dir)

Chris Allegretta's avatar
Chris Allegretta committed
65
66
This manual documents GNU @code{nano}, a small and friendly text
editor.
Chris Allegretta's avatar
Chris Allegretta committed
67
68
69
70
71
72
73
74
75
76
77
78
79
80

@menu
* Introduction::
* Editor Basics::
* Online Help::
* Feature Toggles::
* The File Browser::
* Pico Compatibility::
* Building and Configure Options::
@end menu

@node Introduction, Editor Basics, Top, Top
@chapter Introduction

Chris Allegretta's avatar
Chris Allegretta committed
81
82
83
84
GNU @code{nano} is a small and friendly text editor.  Besides basic text
editing, @code{nano} offers many extra features like an interactive
search and replace, goto line number, auto-indentation, feature toggles,
internationalization support, and filename tab completion.
Chris Allegretta's avatar
Chris Allegretta committed
85
86
87
88
89
90
91
92
93

@menu
* Overview::
* Command Line Options::
@end menu

@node Overview, Command Line Options, Introduction, Introduction
@section Overview

94
@code{nano} [GNU long option] [option] +LINE [ @var{ file ...} ]
Chris Allegretta's avatar
Chris Allegretta committed
95

96
The original goal for @code{nano} was a complete bug-for-bug compatible
Chris Allegretta's avatar
Chris Allegretta committed
97
emulation of Pico, but consistency is now a slightly higher priority. 
Chris Allegretta's avatar
Chris Allegretta committed
98
99
There is a flag to implement (nearly) complete Pico emulation, (option -p
or GNU long option --pico).  This can also be toggled from within
100
@code{nano} by typing Meta-P.  @xref{Pico Compatibility}, for more
Chris Allegretta's avatar
Chris Allegretta committed
101
102
103
104
105
106
107
info.

Email bug reports to @email{nano@@nano-editor.org}. 

@node Command Line Options, , Overview, Introduction
@section Command Line Options

108
@code{nano} takes the following options from the command line:
109

Chris Allegretta's avatar
Chris Allegretta committed
110
111
@table @code

112
113
114
115
@item -B, --backup
When saving a file, back up the previous version of it to the current
filename suffixed with a ~.

116
117
118
119
@item -D, --dos
Write file in DOS format.

@item -F, --multibuffer
120
Enable multiple file buffers, if available.
121

Chris Allegretta's avatar
Chris Allegretta committed
122
123
124
@item -I, --ignorercfiles
Don't look at /etc/nanorc or ~/.nanorc, if nanorc support is available.

Jordi Mallach's avatar
Jordi Mallach committed
125
126
127
@item -K, --keypad
Do not use the ncurses keypad() call unless necessary.  Try this flag if
you find that the arrow keys on the numeric keypad do not work for you
Chris Allegretta's avatar
Chris Allegretta committed
128
under @code{nano}.
Jordi Mallach's avatar
Jordi Mallach committed
129

130
131
@item -M, --mac
Write file in Mac format.
Chris Allegretta's avatar
Chris Allegretta committed
132

Jordi Mallach's avatar
Jordi Mallach committed
133
134
135
136
137
138
@item -N, --noconvert
Do not convert files from DOS/Mac format.

@item -Q [str], --quotestr [str]
Set the quoting string for justifying.  The default is "> ".

Chris Allegretta's avatar
Chris Allegretta committed
139
140
141
@item -R, --regexp
Turns on regular expression search and search/replace.

142
143
144
145
146
147
@item -S, --smooth
Enables smooth scrolling.

@item -T [num], --tabsize=[num]
Set the displayed tab length to [num] columns.

Chris Allegretta's avatar
Chris Allegretta committed
148
149
150
@item -V, --version 
Print the version number and copyright and quit.

151
152
153
154
@item -Y, --syntax=[str]
Specify a specific syntax highlighting from the .nanorc to use, if
available.

Chris Allegretta's avatar
Chris Allegretta committed
155
@item -c, --const
156
Constantly display the cursor position and line number on the statusbar.
Chris Allegretta's avatar
Chris Allegretta committed
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176

@item -h, --help
Print the usage and exit.

@item -i, --autoindent
Automatically indent new lines to the same number of spaces and tabs as
the previous line.

@item -k, --cut
Makes ^K cut from the current cursor position to the end of the current
line.

@item -l, --nofollow
When writing files, if the given file is a symbolic link it is removed
and a new file is created.

@item -m, --mouse
Enables the use of the mouse to select text (currently only useful for
running under the X window system).

177
@item -o [dir], --operatingdir=[dir]
Chris Allegretta's avatar
Chris Allegretta committed
178
179
Set operating directory. Makes @code{nano} set up something similar to a
chroot.
180

Chris Allegretta's avatar
Chris Allegretta committed
181
182
183
184
185
186
@item -p, --pico
Emulate Pico as closely as possible, sacrificing consistency for correct
emulation.  @xref{Pico Compatibility}, for more info.

@item -r [#cols], --fill=[#cols].
Wrap lines at column #cols.  By default this is the width of the screen,
187
188
189
less eight. If this value is negative, wrapping will occur at #cols from
the right of the screen, allowing it to vary along with the screen width
if the screen is resized.
Chris Allegretta's avatar
Chris Allegretta committed
190
191

@item -s [prog], --speller=[prog]
192
193
Invoke [prog] as the spell checker.  By default, @code{nano} uses its
own interactive spell checker that requires the @code{spell} program be
Chris Allegretta's avatar
Chris Allegretta committed
194
195
196
197
installed on your system.

@item -t, --tempfile
Do not ask whether or not to save the current contents of the file when
198
exiting, assume yes.  This is most useful when using @code{nano} as the
Chris Allegretta's avatar
Chris Allegretta committed
199
200
201
202
203
204
205
206
composer of a mailer program.

@anchor{Expert Mode}
@item -x, --nohelp
In Expert Mode, the Shortcut Lists will not appear at the bottom of the 
screen.  This affects the location of the statusbar as well, as in Expert
Mode it is located at the very bottom of the editor.

207
Note: When accessing the help system, Expert Mode is temporarily disabled
Chris Allegretta's avatar
Chris Allegretta committed
208
209
210
211
212
213
214
215
216
217
218
219
to display the help system navigation keys.

@item -v, --view
Do not allow the contents of the file to be altered.  Note that this
flag should NOT be used in place of correct file permissions to implement
a read-only file.

@item -w, --nowrap
Do not wrap long lines at any length. This option overrides any value for
-r.

@item -z, --suspend
220
Enable suspend ability of @code{nano} using the system's suspend
Chris Allegretta's avatar
Chris Allegretta committed
221
222
keystroke (usually ^Z).

223
@item -a, -b, -e, -f, -g, -j
224
225
Ignored, for compatibility with Pico.

Chris Allegretta's avatar
Chris Allegretta committed
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
@item +LINE
Start at line number LINE instead of the default of line 1.
@end table

@node Editor Basics, Online Help, Introduction, Top
@chapter Editor Basics
@menu
* Entering Text::
* Special Functions::
* The Titlebar::
* The Statusbar::
* Shortcut Lists::
@end menu

@node Entering Text, Special Functions, Editor Basics, Editor Basics
@section Entering Text

243
244
All key sequences in @code{nano} are entered using the keyboard.
@code{nano} is a "modeless" editor, all keys with the exception of
Chris Allegretta's avatar
Chris Allegretta committed
245
246
247
248
249
250
251
Control and Meta key sequences will enter text into the file being
edited.  

@node Special Functions, The Titlebar, Entering Text, Editor Basics
@section Special Functions

Special functions use the Control key (displayed in the help and
252
shortcut lists as ^) or the Meta key (displayed as M).
Chris Allegretta's avatar
Chris Allegretta committed
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
     
@itemize @bullet
     
@item
Control key sequences are entered by holding down the Control key and
pressing the desired letter.  
@item
Meta key sequences can be entered in a number of
possible ways: Pressing the Escape key, then releasing it and pressing
the desired key, or holding down the Alt key while pressing the desired 
key.  This varies from keyboard to keyboard, and certain commercial
operating systems "swallow" the Alt key so that it never reaches the
application. If your operating system does this, you should use the
Escape key to generate Meta key sequences.
@end itemize

@node The Titlebar, The Statusbar, Special Functions, Editor Basics
@section The Titlebar

The titlebar is the line displayed at the top of the editor.  There are
three sections: left, center and right. The section on the left displays
274
the version of @code{nano} being used.  The center section displays the
Chris Allegretta's avatar
Chris Allegretta committed
275
276
current file name, or "New Buffer" if the file has not yet been named.
The section on the right will display "Modified" if the file has been
277
modified since it was last saved or opened.
Chris Allegretta's avatar
Chris Allegretta committed
278

Chris Allegretta's avatar
Chris Allegretta committed
279
280
Special modes: When @code{nano} is in "File browser" mode, the center
section will display the current directory instead of the filename.
Chris Allegretta's avatar
Chris Allegretta committed
281
282
283
284
285
@xref{The File Browser}.

@node The Statusbar, Shortcut Lists, The Titlebar, Editor Basics
@section The Statusbar

286
287
The statusbar is located three lines from the bottom of the screen (or
the bottom line in Expert Mode.  @xref{Expert Mode}, for more info.
Chris Allegretta's avatar
Chris Allegretta committed
288
289
290
291

The Statusbar shows important and informational messages.  Any error
messages that occur from using the editor will appear on the statusbar.
Any questions that are asked of the user will be asked on the statusbar,
292
293
and any user input (search strings, file names, etc) will be input on
the statusbar.
Chris Allegretta's avatar
Chris Allegretta committed
294
295
296
297

@node Shortcut Lists, , The Statusbar, Editor Basics
@section Shortcut Lists

298
299
300
301
The Shortcut Lists are the two lines at the bottom of the screen which
show some of the more commonly used functions in the editor. The exact
functions which are displayed depend on whether Pico Compatibility Mode
mode is enabled. @xref{Pico Compatibility}, for more info.
Chris Allegretta's avatar
Chris Allegretta committed
302
303
304
305

@node Online Help, Feature Toggles, Editor Basics, Top
@chapter Online Help

306
The online help system in @code{nano} is available by pressing ^G.
Chris Allegretta's avatar
Chris Allegretta committed
307
308
309
310
311
312
313
314
315
316
317
It is fairly self explanatory, documenting the various parts of the 
editor and available keystrokes.  Navigation is via the ^Y (Page Up)
and ^V (Page Down) keys.  ^X exits the help system.


@node Feature Toggles, The File Browser, Online Help, Top
@chapter Feature Toggles

Toggles allow you to change certain aspects of the editor that
would normally be done via command line flags. They are invoked via
certain Meta key sequenced. @xref{Special Functions}, for more info.
318
The following global toggles are available:
Chris Allegretta's avatar
Chris Allegretta committed
319
320
321

@table @code

322
323
@item Backup File Toggle (Meta-B)
toggles the -B (--backup) command line flag.
Chris Allegretta's avatar
Chris Allegretta committed
324

325
326
327
328
329
330
@item DOS Format Toggle (Meta-D)
toggles the -D (--dos) command line flag.

@item Multiple Files Toggle (Meta-F)
toggles the  -F (--multibuffer) command line flag.

Chris Allegretta's avatar
Chris Allegretta committed
331
332
333
334
335
336
@item AutoIndent Toggle (Meta-I)
toggles the -i (--autoindent) command line flag.

@item Cut To End Toggle (Meta-K)
toggles the -k (--cut) command line flag.

337
@item Mouse Toggle (Meta-M)
Chris Allegretta's avatar
Chris Allegretta committed
338
339
toggles the -m (--mouse) command line flag.

340
341
342
@item Mac Format Toggle (Meta-O)
toggles the -M (--mac) command line flag.

Chris Allegretta's avatar
Chris Allegretta committed
343
344
345
346
@item Pico Mode Toggle (Meta-P)
toggles the -p (--pico) command line flag.
@xref{Pico Compatibility}, for more info.

347
348
349
@item Smooth Scrolling Toggle (Meta-S)
toggles the -s (--smooth) command line flag.

Chris Allegretta's avatar
Chris Allegretta committed
350
351
352
353
354
355
356
@item AutoWrap Toggle (Meta-W)
toggles the -w (--nowrap) command line flag.

@item Expert/Nohelp Toggle (Meta-X)
toggles the -x (--nohelp) command line flag.

@item Suspend Toggle (Meta-Z)
357
toggles the -z (--suspend) command line flag.
Chris Allegretta's avatar
Chris Allegretta committed
358

359
360
361
362
363
364
365
@item Open Previous File Toggle (Meta-<)
changes buffer to previously loaded file.

@item Open Next File Toggle (Meta->)
changes buffer to next loaded file.


Chris Allegretta's avatar
Chris Allegretta committed
366
367
368
369
370
@end table

@node The File Browser, Pico Compatibility, Feature Toggles, Top
@chapter The File Browser

371
When reading or writing files, pressing ^T will invoke the file browser.
372
373
Here, one can navigate directories in a graphical manner in order to
find the desired file.
Chris Allegretta's avatar
Chris Allegretta committed
374
375

Basic movement in the file browser is accomplished with he arrow keys
376
377
378
379
380
and page up/down.  The behavior of the enter (or 's') key varies by what
is currently selected.  If the currently selected object is a directory,
the file browser will enter and display the contents of the directory. 
If the object is a file, this filename and path are copied to the
statusbar and the file browser is exited.
Chris Allegretta's avatar
Chris Allegretta committed
381
382
383
384

@node Pico Compatibility, Building and Configure Options, The File Browser, Top
@chapter Pico Compatibility

Chris Allegretta's avatar
Chris Allegretta committed
385
nano does not completely emulate Pico by default.  The following
386
differences apply to the default mode and Pico Compatibility mode:
Chris Allegretta's avatar
Chris Allegretta committed
387
388
389

@table @code
@item Displayed Shortcuts
Chris Allegretta's avatar
Chris Allegretta committed
390
By default, the following shortcuts are displayed in the Shortcut Lists:
Chris Allegretta's avatar
Chris Allegretta committed
391
392
393
394
395

^G ^O ^\ ^Y ^K ^C@*
^X ^R ^W ^V ^U ^T

Related functions are listed above or below each other by default.  The
Chris Allegretta's avatar
Chris Allegretta committed
396
Justify function is not listed, instead the "Replace" function is
Chris Allegretta's avatar
Chris Allegretta committed
397
displayed. Also, he "Read File" and "WriteOut" functions are aligned for
Chris Allegretta's avatar
Chris Allegretta committed
398
consistency.
Chris Allegretta's avatar
Chris Allegretta committed
399
400
401
402
403
404
405
406
407
408

In Pico Compatibility mode, the default Pico shortcuts are displayed:

^G ^O ^R ^Y ^K ^C@*
^X ^J ^W ^V ^U ^T   

@item Previous String Text
By default, previously entered string for a function (search string,
file name) will be placed on the statusbar, and is editable.  This is
done so there is consistency across all functions.  For example: even if
Chris Allegretta's avatar
Chris Allegretta committed
409
410
there is a previous replace string, it can always be deleted if one
wishes to perform an empty string replace.
Chris Allegretta's avatar
Chris Allegretta committed
411
412
413
414
415
416
417
418

In Pico Compatibility Mode, the previously entered text in a search or
replace will appear in brackets, and is not editable.  It is not a
simple matter to do an empty string replace when a previous replace
string exists, for example.  When writing a file, the previous filename
will be displayed in the editable text portion of the editor.

@item Interactive Replace and Spell Checker
419
It is worth noting that the @code{nano} replace function is interactive,
Chris Allegretta's avatar
Chris Allegretta committed
420
i.e. it does not stop after one search string is found and automatically 
421
replace it.  The @code{nano} implementation will stop at each search
Chris Allegretta's avatar
Chris Allegretta committed
422
423
string found and query whether to replace this instance or not.  The 
internal spell checker operates similarly.  Note that these is no way 
Chris Allegretta's avatar
Chris Allegretta committed
424
to force these functions to behave in the Pico fashion.
Chris Allegretta's avatar
Chris Allegretta committed
425
426
427
428
429
@end table

@node Building and Configure Options, , Pico Compatibility, Top
@chapter Building and Configure Options

Chris Allegretta's avatar
Chris Allegretta committed
430
Building @code{nano} from source is fairly straightforward if you are familiar
Chris Allegretta's avatar
Chris Allegretta committed
431
432
with compiling programs with autoconf support:

Chris Allegretta's avatar
Chris Allegretta committed
433
tar xvfz nano-x.y.z.tar.gz (where x.y.z is the version of @code{nano})
Chris Allegretta's avatar
Chris Allegretta committed
434
435
436
437
438
cd nano-x.y.z/
./configure
make
make install

Chris Allegretta's avatar
Chris Allegretta committed
439
440
if you are looking to optimize @code{nano} for size, you may want to
consider the following command line options:
Chris Allegretta's avatar
Chris Allegretta committed
441
442
443
444
445
446
447
448
449
450
451


@table @code

@item --disable-tabcomp
Disable the tab completion code when reading or writing files.

@item --disable-justify
Disable the justify (^J)/unjustify (^U) functions in the editor.

@item --disable-speller
452
Disables spell checker ability.
Chris Allegretta's avatar
Chris Allegretta committed
453
454

@item --disable-help
Chris Allegretta's avatar
Chris Allegretta committed
455
456
457
Disables the help function (^G).  Disabling this option makes the binary
much smaller, but makes it difficult for new users to learn more than
very basic things about using the editor.
Chris Allegretta's avatar
Chris Allegretta committed
458
459
460
461
462

@item --disable-browser
Disables the mini file browser (^O) when reading or writing files.

@item --enable-tiny
Chris Allegretta's avatar
Chris Allegretta committed
463
464
465
466
This options disables all the above.  It also disables some of the larger
internals of the editor, like the marker code (^^) and the cut to line
(-k) option which it depends on to work properly.  It also disables the
function toggles and mouse support.
467
468

@item --disable-wrapping
Chris Allegretta's avatar
Chris Allegretta committed
469
470
Disables all word wrapping in the editor.  This also eliminates the -w
command line flag, as nonwrapping is then the default behavior.
471

472
@item --disable-mouse
Chris Allegretta's avatar
Chris Allegretta committed
473
474
Disables all mouse functionality.  This also disables the -m command
line flag which enables the mouse functions.
475

476
@item --disable-operatingdir
477
478
Disables setting of operating directory. This also disables the -o
command line flag.
479
480

@item --disable-nls
Chris Allegretta's avatar
Chris Allegretta committed
481
482
Disables Native Language support. This will make the available GNU
@code{nano} translations unusable.
483
484

@item --with-slang
Chris Allegretta's avatar
Chris Allegretta committed
485
486
487
Compiling GNU @code{nano} with Slang is supported, and will make the
binary notably smaller than if compiled with ncurses or other curses
libraries.
488

Chris Allegretta's avatar
Chris Allegretta committed
489
490
491
492
@end table

@contents
@bye