summaryrefslogtreecommitdiff
path: root/doc/man/nanorc.5
blob: 3c69209d12de0a2d0d9747c7c4bd0d5117f8da75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
.\" Hey, EMACS: -*- nroff -*-
.\" Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
.\" Free Software Foundation, Inc.
.\"
.\" 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/>.
.\"
.\" $Id: nanorc.5 4508 2010-06-21 03:10:10Z astyanax $
.TH NANORC 5 "version 2.0.0" "August 23, 2007"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME
nanorc \- GNU nano's rcfile
.SH DESCRIPTION
This manual page briefly documents GNU \fBnano\fP's rcfile.
.PP
\fBnano\fP is a small, free and friendly editor which aims to replace
Pico, the default editor included in the non-free Pine package.  Rather
than just copying Pico's look and feel, \fBnano\fP also implements some
missing (or disabled by default) features in Pico, such as "search and
replace" and "go to line and column number".
.PP
The \fInanorc\fP file contains the default settings for \fBnano\fP.  It
should not be in DOS or Mac format.  During startup, \fBnano\fP will
first read its system-wide settings from \fISYSCONFDIR/nanorc\fP, and
then user-specific settings from \fI~/.nanorc\fP.

.SH OPTIONS
The configuration file accepts a series of \fBset\fP and \fBunset\fP
commands, which can be used to configure nano on startup without using
the command line options.  Additionally, the \fBsyntax\fP, \fBcolor\fP,
and \fBicolor\fP keywords are used to define syntax highlighting rules
for different text patterns.  \fBnano\fP will read one command per line.

Options in \fInanorc\fP files take precedence over nano's defaults, and
command line options override \fInanorc\fP settings.  Also, options are
unset by default, except for those that take arguments.

Quotes inside string parameters don't have to be escaped with
backslashes.  The last double quote in the string will be treated as its
end.  For example, for the \fBbrackets\fP option, "\fI"')>]}\fP" will
match \fI"\fP, \fI'\fP, \fI)\fP, \fI>\fP, \fI]\fP, and \fI}\fP.

The supported commands and arguments are:

.TP 3
.B set/unset allow_insecure_backup
When backing up files, allow the backup to succeed even if its permissions
can't be (re)set due to special OS considerations.  You should 
NOT enable this option unless you are sure you need it.
.TP
.B set/unset autoindent
Use auto-indentation.
.TP
.B set/unset backup
Create backup files in \fIfilename~\fP.
.TP
.B set backupdir "\fIdirectory\fP"
Set the directory where \fBnano\fP puts unique backup files if file
backups are enabled.
.TP
.B set/unset backwards
Do backwards searches by default.
.TP
.B set/unset boldtext
Use bold text instead of reverse video text.
.TP
.B set brackets "\fIstring\fP"
Set the characters treated as closing brackets when justifying
paragraphs.  They cannot contain blank characters.  Only closing
punctuation, optionally followed by closing brackets, can end sentences.
The default value is "\fI"')>]}\fP".
.TP
.B set/unset casesensitive
Do case sensitive searches by default.
.TP
.B set/unset const
Constantly display the cursor position in the status bar.
.TP
.B set/unset cut
Use cut to end of line by default.
.TP
.B set fill \fIn\fP
Wrap lines at column number \fIn\fP.  If \fIn\fP is 0 or less, the
maximum line length will be the screen width less \fIn\fP columns.  The
default value is \-8.
.TP
.B set/unset historylog
Enable \fI~/.nano_history\fP for saving and reading search/replace
strings.
.TP
.B set matchbrackets "\fIstring\fP"
Set the opening and closing brackets that can be found by bracket
searches.  They cannot contain blank characters.  The former set must
come before the latter set, and both must be in the same order.  The
default value is "\fI(<[{)>]}\fP".
.TP
.B set/unset morespace
Use the blank line below the titlebar as extra editing space.
.TP
.B set/unset mouse
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
System, and on the console when gpm is running.
.TP
.B set/unset multibuffer
Allow inserting files into their own buffers.
.TP
.B set/unset noconvert
Don't convert files from DOS/Mac format.
.TP
.B set/unset nofollow
Don't follow symlinks when writing files.
.TP
.B set/unset nohelp
Don't display the help lists at the bottom of the screen.
.TP
.B set/unset nonewlines
Don't add newlines to the ends of files.
.TP
.B set/unset nowrap
Don't wrap text at all.
.TP
.B set operatingdir "\fIdirectory\fP"
\fBnano\fP will only read and write files inside \fIdirectory\fP and its
subdirectories.  Also, the current directory is changed to here, so
files are inserted from this diractory.  By default, the operating
directory feature is turned off.
.TP
.B set/unset preserve
Preserve the XON and XOFF keys (^Q and ^S).
.TP
.B set punct "\fIstring\fP"
Set the characters treated as closing punctuation when justifying
paragraphs.  They cannot contain blank characters.  Only closing
punctuation, optionally followed by closing brackets, can end sentences.
The default value is "\fI!.?\fP".
.TP
.B set/unset quiet
\fBnano\fP will not report errors in the \fInanorc\fP file and ask them
to be acknowledged by pressing enter at startup.  If this is used it
should be placed at the top of the file to be fully effective.
.TP
.B set/unset quickblank
Do quick statusbar blanking.  Statusbar messages will disappear after 1
keystroke instead of 25.
.TP
.B set quotestr "\fIstring\fP"
The email-quote string, used to justify email-quoted paragraphs.  This
is an extended regular expression if your system supports them,
otherwise a literal string.  The default value is
"\fI^([\ \\t]*[#:>\\|}])+\fP" if you have extended regular expression
support, or "\fI>\ \fP" otherwise.  Note that '\\t' stands for a literal
Tab character.
.TP
.B set/unset rebinddelete
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
.B set/unset rebindkeypad
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
.B set/unset regexp
Do extended regular expression searches by default.
.TP
.B set/unset smarthome
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
.B set/unset smooth
Use smooth scrolling by default.
.TP
.B set/unset softwrap
Enable soft line wrapping for easier viewing of very long lones.
.TP
.B set speller "\fIspellprog\fP"
Use spelling checker \fIspellprog\fP instead of the built-in one, which
calls \fIspell\fP.
.TP
.B set/unset suspend
Allow \fBnano\fP to be suspended.
.TP
.B set tabsize \fIn\fP
Use a tab size of \fIn\fP columns.  The value of \fIn\fP must be greater
than 0.  The default value is 8.  
.TP
.B set/unset tabstospaces
Convert typed tabs to spaces.
.TP
.B set/unset tempfile
Save automatically on exit, don't prompt.
.TP
.B set/unset undo
Enable experimental generic-purpose undo code.
.TP
.B set/unset view
Disallow file modification.
.TP
.B set/unset softwrap
Enable soft line wrapping for easier viewing of very long lones.
.TP
.B set whitespace "\fIstring\fP"
Set the two characters used to display the first characters of tabs and
spaces.  They must be single-column characters.
.TP
.B set/unset wordbounds
Detect word boundaries more accurately by treating punctuation
characters as parts of words.
.TP
.B syntax "\fIstr\fP" ["\fIfileregex\fP" ... ]
Defines a syntax named \fIstr\fP which can be activated via the
\-Y/\-\-syntax command line option, or will be automatically activated if
the current filename matches the extended regular expression
\fIfileregex\fP.  All following \fBcolor\fP and \fBicolor\fP statements
will apply to \fIsyntax\fP until a new syntax is defined.

The \fInone\fP syntax is reserved; specifying it on the command line is
the same as not having a syntax at all.  The \fIdefault\fP syntax is
special: it takes no \fIfileregex\fP, and applies to files that don't
match any other syntax's \fIfileregex\fP.
.TP
.B color \fIfgcolor\fP,\fIbgcolor\fP "\fIregex\fP" ...
For the currently defined syntax, display all expressions matching
the extended regular expression \fIregex\fP with foreground color
\fIfgcolor\fP and background color \fIbgcolor\fP, at least one of which
must be specified.  Legal colors for foreground and background color
are: white, black, red, blue, green, yellow, magenta, and cyan.  You may
use the prefix "bright" to force a stronger color highlight for the
foreground.  If your terminal supports transparency, not specifying a
\fIbgcolor\fP tells \fBnano\fP to attempt to use a transparent
background.
.TP
.B icolor \fIfgcolor\fP,\fIbgcolor\fP "\fIregex\fP" ...
Same as above, except that the expression matching is case insensitive.
.TP
.B color \fIfgcolor\fP,\fIbgcolor\fP start="\fIsr\fP" end="\fIer\fP"
Display expressions which start with the extended regular expression
\fIsr\fP and end with the extended regular expression \fIer\fP with
foreground color \fIfgcolor\fP and background color \fIbgcolor\fP,
at least one of which must be specified.  This allows syntax
highlighting to span multiple lines.  Note that all subsequent instances
of \fIsr\fP after an initial \fIsr\fP is found will be highlighted until
the first instance of \fIer\fP.
.TP
.B icolor \fIfgcolor\fP,\fIbgcolor\fP start="\fIsr\fP" end="\fIer\fP"
Same as above, except that the expression matching is case insensitive.
.TP
.B include "\fIsyntaxfile\fP"
Read in self-contained color syntaxes from \fIsyntaxfile\fP.  Note that
\fIsyntaxfile\fP can only contain \fBsyntax\fP, \fBcolor\fP, and
\fBicolor\fP commands.
.SH KEY BINDINGS
Key bindings may be reassigned via the following commands:
.TP
.B bind \fIkey\fP \fIfunction\fP  \fImenu\fP
Rebinds the key \fIkey\fP to a new function named \fIfunction\fP in the
context of menu \fImenu\fP.  The format of  \fIkey\fP should be one of:
.TP
.B ^ 
followed by an alpha character or the word "Space".
Example: ^C
.TP
.B M- 
followed by a printable character or the word "Space".
Example: M-C
.TP
.B F 
followed by a numeric value from 1 to 16.
Example: F10
.TP
Valid function names to be bound include:
.TP 3
.B help
Invoke the help menu.
.TP
.B cancel
Cancel the current command.
.TP
.B exit
Exit from the program.
.TP
.B writeout
Write the current buffer to disk.
.TP
.B justify
Justify the current text.
.TP
.B insert
Insert a file into the current buffer (or into a new buffer when multibuffer
is enabled).
.TP
.B whereis
Search for text in the current buffer.
.TP
.B searchagain
Repeat the last search command.
.TP
.B up
Move up in the editor or browser.
.TP
.B down
Move down in the editor or browser.
.TP
.B left
Move left in the editor or browser.
.TP
.B right
Move right in the editor or browser.
.TP
.B cut
Cut the current line of text and store it.
.TP
.B uncut
Copy the currently stored text into the current buffer position.
.TP
.B curpos
Show the current line, column, word positions in the file.
.TP
.B firstline
Move to the first line of the file.
.TP
.B lastline
Move to the last line of the file.
.TP
.B gotoline
Move to a specific line (and column if specified).
.TP
.B replace
Interactively replace text within the current buffer.
.TP
.B mark
Begin selecting text for cutting or pasting at the current position.
.TP
.B copytext
Copy the currently marked text without deleting it.
.TP
.B indent
Indent the currently marked text (shift to the right).
.TP
.B unindent
Un-indent the currently marked text (shift to the left).
.TP
.B nextword
Move the cursor to the beginning of the next word.
.TP
.B prevword
Move the cursor to the beginning of the previous word.
.TP
.B home
Move the cursor to the beginning of the current line.
.TP
.B end
Move the cursor to the end of the current line.
.TP
.B beginpara
Move the cursor to the beginning of the current paragraph.
.TP
.B endpara
Move the cursor to the end of the current paragraph.
.TP
.B findbracket
Move the cursor to the matching bracket (brace, parenthesis, etc.) of the one
under the cursor.
.TP
.B scrollup
Scroll up one line of text from the current position.
.TP
.B scrolldown
Scroll down one line of text from the current position.
.TP
.B prevbuf
Switch to editing/viewing the previous buffer when using multibuffer mode.
.TP
.B nextbuf
Switch to editing/viewing the next buffer when using multibuffer mode.
.TP
.B verbatim
Insert the next character verbatim into the file.
.TP
.B tab
Insert a tab at the current cursor location.
.TP
.B enter
Insert a new line below the current one.
.TP
.B delete
Delete the character under the cursor.
.TP
.B fulljustify
Justify the entire current file.
.TP
.B wordcount
Count the number of words in the current buffer.
.TP
.B refresh
Refresh the screen.
.TP
.B undo
Undo the text action peformed (add text, delete text, etc).
.TP
.B redo
Redo the last undone action (i.e., undo an undo).
.TP
.B suspend
Suspend the editor (if the suspend function is enabled, see the 
"suspendenable" entry below).
.TP
.B casesens
Toggle case sensitivity in searching (search/replace menus only).
.TP
.B regexp
Toggle whether searching/replacing is based on literal strings or regular expressions.
.TP
.B prevhistory
Show the previous history entry in the prompt menus (e.g. search).
.TP
.B nexthistory
Show the next history entry in the prompt menus (e.g. search).
.TP
.B dontreplace
Switch back to searching instead of replacing.
.TP
.B gototext
Search for files matching a string in the file browser (reading or writing files).
.TP
.B dosformat
When writing a file, switch to writing a DOS format (CR/LF).
.TP
.B macformat
When writing a file, switch to writing a Mac format.
.TP
.B append
When writing a file, append to the end instead of overwriting.
.TP
.B prepend
When writing a file, 'prepend' (write at the beginning) instead of overwriting.
.TP
.B backup
When writing a file, create a backup of the current file. 
.TP
.B firstfile
Move to the first file when using the file browser (reading or writing files).
.TP
.B lastfile
Move to the last file when using the file browser (reading or writing files).
.TP
.B nohelp
Toggle showing/hiding the two-line list of key bindings at the bottom of the screen.
.TP
.B constupdate
Constantly display the current line, column, word positions.
.TP
.B morespace
Toggle showing/hiding the blank line which 'separates' the 'title' from the file text.
.TP
.B smoothscroll
Toggle smooth scrolling when moving via the arrow keys.
.TP
.B whitespacedisplay
Toggle whether whitespace is shown.
.TP
.B smarthome
Toggle whether the smart home key function is enabled.
.TP
.B autoindent
Toggle whether new lines will contain the same amount of whitespace as the line above.
.TP
.B cuttoend
Toggle whether cutting text will cut the whole line or just from the current cursor
position to the end of the line.
.TP
.B nowrap
Toggle whether long lines will be wrapped to the next line.
.TP
.B suspendenable
Toggle whether the suspend sequence (normally ^Z) will suspend the editor window.
.TP

Valid menu sections are:
.TP
.B main
The main editor window where text is entered.
.TP
.B search
The search menu (AKA whereis).
.TP
.B replace
The 'search to replace' menu.
.TP
.B replacewith
The 'replace with' menu, which comes up after 'search to replace'.
.TP
.B gotoline
The 'goto line (and column)' menu.
.TP
.B writeout
The 'write file' menu.
.TP
.B insert
The 'insert file' menu.
.TP
.B extcmd
The menu for inserting output from an external comman, reached from the insert menu.
.TP
.B help
The help menu.
.TP
.B spell
The interactive spell checker Yes/no menu.
.TP
.B browser
The file browser for inserting or writing a file.
.TP
.B whereisfile
The 'search for a file' menu in the file browser.
.TP
.B gotodir
The 'go to directory' menu.
.TP
.B all
A special name meaning: apply to all menus where this function exists.

.TP
.B unbind \fIkey\fP \fImenu\fP
Unbind the key \fIkey\fP from the menu named \fImenu\fP or from all 
menus by using \fIall\fP.  Same key syntax as for binding.
Rebinds the key \fIkey\fP to a new function named \fIfunction\fP in the
context of menu \fImenu\fP.  The format of  \fIkey\fP should be one of:
.SH FILES
.TP
.I SYSCONFDIR/nanorc
System-wide configuration file
.TP
.I ~/.nanorc
Per-user configuration file
.SH SEE ALSO
.PD 0
.TP
\fBnano\fP(1)
.PP
\fI/usr/share/doc/nano/examples/nanorc.sample\fP (or equivalent on your
system)
.SH AUTHOR
Chris Allegretta <chrisa@asty.org>, et al (see \fIAUTHORS\fP and
\fITHANKS\fP for details).  This manual page was originally written by
Jordi Mallach <jordi@gnu.org>, for the Debian system (but may be used by
others).