nano.1 12.4 KB
Newer Older
1
.\" Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
2
.\" 2009, 2010, 2013, 2014 Free Software Foundation, Inc.
Jordi Mallach's avatar
   
Jordi Mallach committed
3
.\"
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
.\" This document is dual-licensed.  You may distribute and/or modify it
.\" under the terms of either of the following licenses:
.\"
.\" * The GNU General Public License, as published by the Free Software
.\"   Foundation, version 3 or (at your option) any later version.  You
.\"   should have received a copy of the GNU General Public License
.\"   along with this program.  If not, see
.\"   <http://www.gnu.org/licenses/>.
.\"
.\" * The GNU Free Documentation License, as published by the Free
.\"   Software Foundation, version 1.2 or (at your option) any later
.\"   version, with no Invariant Sections, no Front-Cover Texts, and no
.\"   Back-Cover Texts.  You should have received a copy of the GNU Free
.\"   Documentation License along with this program.  If not, see
.\"   <http://www.gnu.org/licenses/>.
Jordi Mallach's avatar
   
Jordi Mallach committed
19
.\"
20
.TH NANO 1 "version 2.7.0" "September 2016"
Chris Allegretta's avatar
Chris Allegretta committed
21
.\" Please adjust this date whenever revising the manpage.
Jordi Mallach's avatar
Jordi Mallach committed
22

Chris Allegretta's avatar
Chris Allegretta committed
23
.SH NAME
24
nano \- Nano's ANOther editor, an enhanced free Pico clone
Jordi Mallach's avatar
Jordi Mallach committed
25

Chris Allegretta's avatar
Chris Allegretta committed
26
27
.SH SYNOPSIS
.B nano
28
.RI [ options "] [[+" line [, column "]]\ " file "]..."
Jordi Mallach's avatar
Jordi Mallach committed
29

Chris Allegretta's avatar
Chris Allegretta committed
30
.SH DESCRIPTION
Jordi Mallach's avatar
   
Jordi Mallach committed
31
\fBnano\fP is a small, free and friendly editor which aims to replace
32
33
Pico, the default editor included in the non-free Pine package.  On
top of copying Pico's look and feel, \fBnano\fP also implements some
Chris Allegretta's avatar
Chris Allegretta committed
34
missing (or disabled by default) features in Pico, such as "search and
35
replace" and "go to line and column number".
Jordi Mallach's avatar
Jordi Mallach committed
36

37
38
39
.SH EDITING
Entering text and moving around in a file is straightforward: typing the
letters and using the normal cursor movement keys.  Commands are entered
40
by using the Control (^) and the Alt or Meta (M\-) keys.
41
42
43
44
45
46
47
48
Typing \fB^K\fR deletes the current line and puts it in the cutbuffer.
Consecutive \fB^K\fRs will put all deleted lines together in the cutbuffer.
Any cursor movement or executing any other command will cause the next
\fB^K\fR to overwrite the cutbuffer.  A \fB^U\fR will paste the current
contents of the cutbuffer at the current cursor position.
.PP
When a more precise piece of text needs to be cut or copied, one can mark
its start with \fB^6\fR, move the cursor to its end (the marked text will be
49
highlighted), and then use \fB^K\fR to cut it, or \fBM\-6\fR to copy it to the
50
cutbuffer.  One can also save the marked text to a file with \fB^O\fR, or
51
52
spell check it with \fB^T\fR.
.PP
53
54
55
56
Since nano-2.7.0, text can also be selected by holding Shift and moving the
cursor with the arrow keys.  Holding down the Alt key too will increase the
stride.
.PP
57
58
59
60
61
The two lines at the bottom of the screen show the most important commands;
the built-in help (\fB^G\fR) lists all the available ones.
The default key bindings can be changed via the .nanorc file -- see
.BR nanorc (5).

Chris Allegretta's avatar
Chris Allegretta committed
62
63
.SH OPTIONS
.TP
64
.B +\fIline\fP,\fIcolumn\fP
65
Places the cursor on line number \fIline\fP and at column number \fIcolumn\fP
66
(at least one of which must be specified) on startup, instead of the
67
default line 1, column 1.
68
.TP
69
.BR \-A ", " \-\-smarthome
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
70
71
72
73
74
75
Make the Home key smarter.  When Home is pressed anywhere but at the
very beginning of non-whitespace characters on a line, the cursor will
jump to that beginning (either forwards or backwards).  If the cursor is
already at that position, it will jump to the true beginning of the
line.
.TP
76
.BR \-B ", " \-\-backup
77
When saving a file, back up the previous version of it, using the current
78
filename suffixed with a tilde (\fB~\fP).
79
.TP
80
.BR \-C\ \fIdirectory\fR ", " \-\-backupdir= \fIdirectory
81
82
83
Make and keep not just one backup file, but make and keep a uniquely
numbered one every time a file is saved -- when backups are enabled.
The uniquely numbered files are stored in the specified \fIdirectory\fR.
84
.TP
85
.BR \-D ", " \-\-boldtext
86
87
Use bold text instead of reverse video text.
.TP
88
.BR \-E ", " \-\-tabstospaces
89
90
Convert typed tabs to spaces.
.TP
91
.BR \-F ", " \-\-multibuffer
92
Enable multiple file buffers (if support for them has been compiled in).
Chris Allegretta's avatar
Chris Allegretta committed
93
.TP
94
.BR \-G ", " \-\-locking
95
96
Enable vim-style file locking when editing files.
.TP
97
.BR \-H ", " \-\-historylog
98
Log search and replace strings to \fI~/.nano/search_history\fP, so they can be
99
retrieved in later sessions.
100
.TP
101
.BR \-I ", " \-\-ignorercfiles
102
Don't look at the system's \fBnanorc\fP nor at \fB~/.nanorc\fP.
Chris Allegretta's avatar
Chris Allegretta committed
103
.TP
104
.BR \-K ", " \-\-rebindkeypad
105
106
107
108
Interpret the numeric keypad keys so that they all work properly.  You
should only need to use this option if they don't, as mouse support
won't work properly with this option enabled.
.TP
109
.BR \-L ", " \-\-nonewlines
110
111
Don't add newlines to the ends of files.
.TP
112
.BR \-N ", " \-\-noconvert
113
114
Disable automatic conversion of files from DOS/Mac format.
.TP
115
.BR \-O ", " \-\-morespace
116
117
Use the blank line below the titlebar as extra editing space.
.TP
118
.BR \-P ", " \-\-positionlog
119
120
121
For the 200 most recent files, log the last position of the cursor,
and place it at that position again upon reopening such a file.
(The old form of this option, \fB\-\-poslog\fR, is deprecated.)
122
.TP
123
.BR "\-Q ""\fIcharacters\fB""" ", " "\-\-quotestr=""" \fIcharacters\fR """
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
124
Set the quoting string for justifying.  The default is
125
126
\fB"^([\ \\t]*[#:>\\|}])+"\fP if extended regular expression support is
available, or \fB">\ "\fP otherwise.  Note that \fB\\t\fP stands for a
127
Tab.
Chris Allegretta's avatar
Chris Allegretta committed
128
.TP
129
.BR \-R ", " \-\-restricted
130
Restricted mode: don't read or write to any file not specified on the
131
132
command line; don't read any \fInanorc\fP files nor history files;
don't allow suspending nor spell checking;
133
don't allow a file to be appended to, prepended to, or saved under a
134
135
different name if it already has one; and don't use backup files.
This restricted mode is also accessible by invoking \fBnano\fP
136
with any name beginning with 'r' (e.g. "rnano").
137
.TP
138
.BR \-S ", " \-\-smooth
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
139
Enable smooth scrolling.  Text will scroll line-by-line, instead of the
Chris Allegretta's avatar
Chris Allegretta committed
140
usual chunk-by-chunk behavior.
141
.TP
142
.BR \-T\ \fInumber\fR ", " \-\-tabsize= \fInumber
143
144
Set the size (width) of a tab to \fInumber\fP columns.  The value of
\fInumber\fP must be greater than 0.  The default value is 8.
145
.TP
146
.BR \-U ", " \-\-quickblank
147
Do quick statusbar blanking.  Statusbar messages will disappear after 1
148
keystroke instead of 25.  Note that \fB\-c\fP overrides this.
149
.TP
150
.BR \-V ", " \-\-version
151
Show the current version number and exit.
Chris Allegretta's avatar
Chris Allegretta committed
152
.TP
153
.BR \-W ", " \-\-wordbounds
154
Detect word boundaries differently by treating punctuation
155
156
characters as part of a word.
.TP
157
158
159
160
161
.BR "\-X ""\fIcharacters\fB""" ", " "\-\-wordchars=""" \fIcharacters """
Specify which other characters (besides the normal alphanumeric ones)
should be considered as part of a word.  This overrides option
\fB\-W\fR (\fB\-\-wordbounds\fR).
.TP
162
.BR \-Y\ \fIname\fR ", " \-\-syntax= \fIname
163
164
Specify the name of the syntax highlighting to use from among the ones
defined in the \fInanorc\fP files.
165
.TP
166
.BR \-c ", " \-\-constantshow
167
Constantly show the cursor position.  Note that this overrides \fB\-U\fP.
Chris Allegretta's avatar
Chris Allegretta committed
168
.TP
169
.BR \-d ", " \-\-rebinddelete
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
170
171
172
173
Interpret the Delete key differently so that both Backspace and Delete
work properly.  You should only need to use this option if Backspace
acts like Delete on your system.
.TP
174
.BR \-h ", " \-\-help
175
Show a summary of the available command-line options and exit.
176
.TP
177
.BR \-i ", " \-\-autoindent
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
178
179
Indent new lines to the previous line's indentation.  Useful when
editing source code.
Chris Allegretta's avatar
Chris Allegretta committed
180
.TP
181
.BR \-k ", " \-\-cut
182
Make the 'Cut Text' command (normally \fB^K\fR) cut from the current cursor
183
position to the end of the line, instead of cutting the entire line.
184
.TP
185
186
187
.BR \-l ", " \-\-linenumbers
Display line numbers to the left of the text area.
.TP
188
.BR \-m ", " \-\-mouse
189
190
191
Enable mouse support, if available for your system.  When enabled, mouse
clicks can be used to place the cursor, set the mark (with a double
click), and execute shortcuts.  The mouse will work in the X Window
192
193
System, and on the console when gpm is running.  Text can still be
selected through dragging by holding down the Shift key.
Chris Allegretta's avatar
Chris Allegretta committed
194
.TP
195
.BR \-n ", " \-\-noread
196
197
198
199
200
201
Treat any name given on the command line as a new file.  This allows
\fBnano\fR to write to named pipes: it will start with a blank buffer,
and will write to the pipe when the user saves the "file".  This way
\fBnano\fR can be used as an editor in combination with for instance
\fBgpg\fR without having to write sensitive data to disk first.
.TP
202
.BR \-o\ \fIdirectory\fR ", " \-\-operatingdir= \fIdirectory
203
204
Set the operating directory.  This makes \fBnano\fP set up something
similar to a chroot.
205
.TP
206
.BR \-p ", " \-\-preserve
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
207
208
Preserve the XON and XOFF sequences (^Q and ^S) so they will be caught
by the terminal.
Chris Allegretta's avatar
Chris Allegretta committed
209
.TP
210
.BR \-q ", " \-\-quiet
211
Do not report errors in the \fInanorc\fP files nor ask them to be
212
acknowledged by pressing Enter at startup.
213
.TP
214
.BR \-r\ \fInumber\fR ", " \-\-fill= \fInumber
215
216
Hard-wrap lines at column \fInumber\fP.  If this value is 0 or less, wrapping
will occur at the width of the screen less \fInumber\fP columns, allowing
217
the wrap point to vary along with the width of the screen if the screen
218
is resized.  The default value is \-8.  This option conflicts with
219
\fB\-w\fR -- the last one given takes effect.
220
.TP
221
.BR \-s\ \fIprogram\fR ", " \-\-speller= \fIprogram
222
Use this alternative spell checker command.
Chris Allegretta's avatar
Chris Allegretta committed
223
.TP
224
.BR \-t ", " \-\-tempfile
225
Save a changed buffer without prompting (when exiting with \fB^X\fR).
Chris Allegretta's avatar
Chris Allegretta committed
226
.TP
227
228
229
230
231
.BR \-u ", " \-\-unix
Save a file by default in Unix format.  This overrides nano's
default behavior of saving a file in the format that it had.
(This option has no effect when you also use \fB\-\-noconvert\fR.)
.TP
232
.BR \-v ", " \-\-view
233
Just view the file and disallow editing: read-only mode.
Chris Allegretta's avatar
Chris Allegretta committed
234
.TP
235
.BR \-w ", " \-\-nowrap
236
Disable the hard-wrapping of long lines.  This option conflicts with
237
\fB\-r\fR -- the last one given takes effect.
Chris Allegretta's avatar
Chris Allegretta committed
238
.TP
239
.BR \-x ", " \-\-nohelp
240
Don't show the two help lines at the bottom of the screen.
Chris Allegretta's avatar
Chris Allegretta committed
241
.TP
242
.BR \-z ", " \-\-suspend
243
Enable the suspend ability.
Chris Allegretta's avatar
Chris Allegretta committed
244
.TP
245
.BR \-$ ", " \-\-softwrap
246
247
248
Enable 'soft wrapping'.  This will make \fBnano\fP attempt to display the
entire contents of any line, even if it is longer than the screen width, by
continuing it over multiple screen lines.  Since
249
\&'$' normally refers to a variable in the Unix shell, you should specify
250
251
this option last when using other options (e.g.\& 'nano \-wS$') or pass it
separately (e.g.\& 'nano \-wS \-$').
252
.TP
253
.BR \-a ", " \-b ", " \-e ", " \-f ", " \-g ", " \-j
254
Ignored, for compatibility with Pico.
Jordi Mallach's avatar
Jordi Mallach committed
255

256
.SH TOGGLES
257
Several of the above options can be switched on and off also while
258
259
\fBnano\fR is running.  For example, \fBM\-L\fR toggles the
hard-wrapping of long lines, \fBM\-$\fR toggles soft-wrapping,
260
261
\fBM\-#\fR toggles line numbers, \fBM\-M\fR toggles the mouse,
\fBM\-I\fR auto-indentation, and \fBM\-X\fR the help lines.
262
263
See at the end of the \fB^G\fR help text for a complete list.

264
.SH INITIALIZATION FILE
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
265
\fBnano\fP will read initialization files in the following order:
266
267
268
269
the system's \fBnanorc\fP (if it exists), and then the user's
\fB~/.nanorc\fP (if it exists).  Please see
.BR nanorc (5)
for more information on the possible contents of those files.
Jordi Mallach's avatar
Jordi Mallach committed
270

Jordi Mallach's avatar
   
Jordi Mallach committed
271
.SH NOTES
272
If no alternative spell checker command is specified on the command
273
line nor in one of the \fInanorc\fP files, \fBnano\fP will check the
274
\fBSPELL\fP environment variable for one.
275
.sp
276
277
278
In some cases \fBnano\fP will try to dump the buffer into an emergency
file.  This will happen mainly if \fBnano\fP receives a SIGHUP or
SIGTERM or runs out of memory.  It will write the buffer into a file
279
280
named \fInano.save\fP if the buffer didn't have a name already, or will
add a ".save" suffix to the current filename.  If an emergency file with
281
that name already exists in the current directory, it will add ".save"
282
plus a number (e.g.\& ".save.1") to the current filename in order to make
283
it unique.  In multibuffer mode, \fBnano\fP will write all the open
284
buffers to their respective emergency files.
Jordi Mallach's avatar
Jordi Mallach committed
285

Chris Allegretta's avatar
Chris Allegretta committed
286
.SH BUGS
287
Justifications (\fB^J\fR) and reindentations (\fBM\-{\fR and \fBM\-}\fR)
288
289
290
291
292
293
are not yet covered by the general undo system.  So after a justification
that is not immediately undone, or after any reindentation, earlier edits
cannot be undone any more.  The workaround is, of course, to exit without
saving.
.sp
Please report any other bugs that you encounter via
294
\fIhttps://savannah.gnu.org/bugs/?group=nano\fR.
Jordi Mallach's avatar
Jordi Mallach committed
295

Chris Allegretta's avatar
Chris Allegretta committed
296
.SH HOMEPAGE
297
https://nano-editor.org/
Jordi Mallach's avatar
Jordi Mallach committed
298
299

.SH SEE ALSO
300
.BR nanorc (5)
Jordi Mallach's avatar
Jordi Mallach committed
301
302
303
.PP
\fI/usr/share/doc/nano/\fP (or equivalent on your system)

Chris Allegretta's avatar
Chris Allegretta committed
304
.SH AUTHOR
305
Chris Allegretta and others (see the files \fIAUTHORS\fR and
306
\fITHANKS\fP for details).  This manual page was originally written by
307
Jordi Mallach for the Debian system (but may be used by others).