Imported Upstream version 2.3.1
[platform/upstream/nano.git] / doc / man / nanorc.5
1 .\" Hey, EMACS: -*- nroff -*-
2 .\" Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
3 .\" Free Software Foundation, Inc.
4 .\"
5 .\" This document is dual-licensed.  You may distribute and/or modify it
6 .\" under the terms of either of the following licenses:
7 .\"
8 .\" * The GNU General Public License, as published by the Free Software
9 .\"   Foundation, version 3 or (at your option) any later version.  You
10 .\"   should have received a copy of the GNU General Public License
11 .\"   along with this program.  If not, see
12 .\"   <http://www.gnu.org/licenses/>.
13 .\"
14 .\" * The GNU Free Documentation License, as published by the Free
15 .\"   Software Foundation, version 1.2 or (at your option) any later
16 .\"   version, with no Invariant Sections, no Front-Cover Texts, and no
17 .\"   Back-Cover Texts.  You should have received a copy of the GNU Free
18 .\"   Documentation License along with this program.  If not, see
19 .\"   <http://www.gnu.org/licenses/>.
20 .\"
21 .\" $Id: nanorc.5 4533 2011-02-24 02:14:30Z astyanax $
22 .TH NANORC 5 "version 2.0.0" "August 23, 2007"
23 .\" Please adjust this date whenever revising the manpage.
24 .\"
25 .SH NAME
26 nanorc \- GNU nano's rcfile
27 .SH DESCRIPTION
28 This manual page briefly documents GNU \fBnano\fP's rcfile.
29 .PP
30 \fBnano\fP is a small, free and friendly editor which aims to replace
31 Pico, the default editor included in the non-free Pine package.  Rather
32 than just copying Pico's look and feel, \fBnano\fP also implements some
33 missing (or disabled by default) features in Pico, such as "search and
34 replace" and "go to line and column number".
35 .PP
36 The \fInanorc\fP file contains the default settings for \fBnano\fP.  It
37 should not be in DOS or Mac format.  During startup, \fBnano\fP will
38 first read its system-wide settings from \fISYSCONFDIR/nanorc\fP, and
39 then user-specific settings from \fI~/.nanorc\fP.
40
41 .SH OPTIONS
42 The configuration file accepts a series of \fBset\fP and \fBunset\fP
43 commands, which can be used to configure nano on startup without using
44 the command line options.  Additionally, the \fBsyntax\fP, \fBcolor\fP,
45 and \fBicolor\fP keywords are used to define syntax highlighting rules
46 for different text patterns.  \fBnano\fP will read one command per line.
47
48 Options in \fInanorc\fP files take precedence over nano's defaults, and
49 command line options override \fInanorc\fP settings.  Also, options are
50 unset by default, except for those that take arguments.
51
52 Quotes inside string parameters don't have to be escaped with
53 backslashes.  The last double quote in the string will be treated as its
54 end.  For example, for the \fBbrackets\fP option, "\fI"')>]}\fP" will
55 match \fI"\fP, \fI'\fP, \fI)\fP, \fI>\fP, \fI]\fP, and \fI}\fP.
56
57 The supported commands and arguments are:
58
59 .TP 3
60 .B set/unset allow_insecure_backup
61 When backing up files, allow the backup to succeed even if its permissions
62 can't be (re)set due to special OS considerations.  You should 
63 NOT enable this option unless you are sure you need it.
64 .TP
65 .B set/unset autoindent
66 Use auto-indentation.
67 .TP
68 .B set/unset backup
69 Create backup files in \fIfilename~\fP.
70 .TP
71 .B set backupdir "\fIdirectory\fP"
72 Set the directory where \fBnano\fP puts unique backup files if file
73 backups are enabled.
74 .TP
75 .B set/unset backwards
76 Do backwards searches by default.
77 .TP
78 .B set/unset boldtext
79 Use bold text instead of reverse video text.
80 .TP
81 .B set brackets "\fIstring\fP"
82 Set the characters treated as closing brackets when justifying
83 paragraphs.  They cannot contain blank characters.  Only closing
84 punctuation, optionally followed by closing brackets, can end sentences.
85 The default value is "\fI"')>]}\fP".
86 .TP
87 .B set/unset casesensitive
88 Do case sensitive searches by default.
89 .TP
90 .B set/unset const
91 Constantly display the cursor position in the status bar.
92 .TP
93 .B set/unset cut
94 Use cut to end of line by default.
95 .TP
96 .B set fill \fIn\fP
97 Wrap lines at column number \fIn\fP.  If \fIn\fP is 0 or less, the
98 maximum line length will be the screen width less \fIn\fP columns.  The
99 default value is \-8.
100 .TP
101 .B set/unset historylog
102 Enable \fI~/.nano_history\fP for saving and reading search/replace
103 strings.
104 .TP
105 .B set matchbrackets "\fIstring\fP"
106 Set the opening and closing brackets that can be found by bracket
107 searches.  They cannot contain blank characters.  The former set must
108 come before the latter set, and both must be in the same order.  The
109 default value is "\fI(<[{)>]}\fP".
110 .TP
111 .B set/unset morespace
112 Use the blank line below the titlebar as extra editing space.
113 .TP
114 .B set/unset mouse
115 Enable mouse support, if available for your system.  When enabled, mouse
116 clicks can be used to place the cursor, set the mark (with a double
117 click), and execute shortcuts.  The mouse will work in the X Window
118 System, and on the console when gpm is running.
119 .TP
120 .B set/unset multibuffer
121 Allow inserting files into their own buffers.
122 .TP
123 .B set/unset noconvert
124 Don't convert files from DOS/Mac format.
125 .TP
126 .B set/unset nofollow
127 Don't follow symlinks when writing files.
128 .TP
129 .B set/unset nohelp
130 Don't display the help lists at the bottom of the screen.
131 .TP
132 .B set/unset nonewlines
133 Don't add newlines to the ends of files.
134 .TP
135 .B set/unset nowrap
136 Don't wrap text at all.
137 .TP
138 .B set operatingdir "\fIdirectory\fP"
139 \fBnano\fP will only read and write files inside \fIdirectory\fP and its
140 subdirectories.  Also, the current directory is changed to here, so
141 files are inserted from this directory.  By default, the operating
142 directory feature is turned off.
143 .TP
144 .B set/unset preserve
145 Preserve the XON and XOFF keys (^Q and ^S).
146 .TP
147 .B set punct "\fIstring\fP"
148 Set the characters treated as closing punctuation when justifying
149 paragraphs.  They cannot contain blank characters.  Only closing
150 punctuation, optionally followed by closing brackets, can end sentences.
151 The default value is "\fI!.?\fP".
152 .TP
153 .B set/unset quiet
154 \fBnano\fP will not report errors in the \fInanorc\fP file and ask them
155 to be acknowledged by pressing enter at startup.  If this is used it
156 should be placed at the top of the file to be fully effective.
157 .TP
158 .B set/unset quickblank
159 Do quick statusbar blanking.  Statusbar messages will disappear after 1
160 keystroke instead of 25.
161 .TP
162 .B set quotestr "\fIstring\fP"
163 The email-quote string, used to justify email-quoted paragraphs.  This
164 is an extended regular expression if your system supports them,
165 otherwise a literal string.  The default value is
166 "\fI^([\ \\t]*[#:>\\|}])+\fP" if you have extended regular expression
167 support, or "\fI>\ \fP" otherwise.  Note that '\\t' stands for a literal
168 Tab character.
169 .TP
170 .B set/unset rebinddelete
171 Interpret the Delete key differently so that both Backspace and Delete
172 work properly.  You should only need to use this option if Backspace
173 acts like Delete on your system.
174 .TP
175 .B set/unset rebindkeypad
176 Interpret the numeric keypad keys so that they all work properly.  You
177 should only need to use this option if they don't, as mouse support
178 won't work properly with this option enabled.
179 .TP
180 .B set/unset regexp
181 Do extended regular expression searches by default.
182 .TP
183 .B set/unset poslog
184 Save the cursor position of files between editing sessions.
185 .TP
186 .B set/unset smarthome
187 Make the Home key smarter.  When Home is pressed anywhere but at the
188 very beginning of non-whitespace characters on a line, the cursor will
189 jump to that beginning (either forwards or backwards).  If the cursor is
190 already at that position, it will jump to the true beginning of the
191 line.
192 .TP
193 .B set/unset smooth
194 Use smooth scrolling by default.
195 .TP
196 .B set/unset softwrap
197 Enable soft line wrapping for easier viewing of very long lones.
198 .TP
199 .B set speller "\fIspellprog\fP"
200 Use spelling checker \fIspellprog\fP instead of the built-in one, which
201 calls \fIspell\fP.
202 .TP
203 .B set/unset suspend
204 Allow \fBnano\fP to be suspended.
205 .TP
206 .B set tabsize \fIn\fP
207 Use a tab size of \fIn\fP columns.  The value of \fIn\fP must be greater
208 than 0.  The default value is 8.  
209 .TP
210 .B set/unset tabstospaces
211 Convert typed tabs to spaces.
212 .TP
213 .B set/unset tempfile
214 Save automatically on exit, don't prompt.
215 .TP
216 .B set/unset undo
217 Enable experimental generic-purpose undo code.
218 .TP
219 .B set/unset view
220 Disallow file modification.
221 .TP
222 .B set/unset softwrap
223 Enable soft line wrapping for easier viewing of very long lones.
224 .TP
225 .B set whitespace "\fIstring\fP"
226 Set the two characters used to display the first characters of tabs and
227 spaces.  They must be single-column characters.
228 .TP
229 .B set/unset wordbounds
230 Detect word boundaries more accurately by treating punctuation
231 characters as parts of words.
232 .TP
233 .B syntax "\fIstr\fP" ["\fIfileregex\fP" ... ]
234 Defines a syntax named \fIstr\fP which can be activated via the
235 \-Y/\-\-syntax command line option, or will be automatically activated if
236 the current filename matches the extended regular expression
237 \fIfileregex\fP.  All following \fBcolor\fP and \fBicolor\fP statements
238 will apply to \fIsyntax\fP until a new syntax is defined.
239
240 The \fInone\fP syntax is reserved; specifying it on the command line is
241 the same as not having a syntax at all.  The \fIdefault\fP syntax is
242 special: it takes no \fIfileregex\fP, and applies to files that don't
243 match any other syntax's \fIfileregex\fP.
244 .TP
245 .B magic ["\fIregex\fP" ... ]
246 For the currently defined syntax, add one or more regexes which 
247 will be compared against the \fBmagic\fP database when attempting
248 to determine which highlighting rules to use for a given file. This 
249 functionality only works when \fBlibmagic\fP is installed on the 
250 system and will be silently ignored otherwise.
251 .TP
252 .B color \fIfgcolor\fP,\fIbgcolor\fP "\fIregex\fP" ...
253 For the currently defined syntax, display all expressions matching
254 the extended regular expression \fIregex\fP with foreground color
255 \fIfgcolor\fP and background color \fIbgcolor\fP, at least one of which
256 must be specified.  Legal colors for foreground and background color
257 are: white, black, red, blue, green, yellow, magenta, and cyan.  You may
258 use the prefix "bright" to force a stronger color highlight for the
259 foreground.  If your terminal supports transparency, not specifying a
260 \fIbgcolor\fP tells \fBnano\fP to attempt to use a transparent
261 background.
262 .TP
263 .B icolor \fIfgcolor\fP,\fIbgcolor\fP "\fIregex\fP" ...
264 Same as above, except that the expression matching is case insensitive.
265 .TP
266 .B color \fIfgcolor\fP,\fIbgcolor\fP start="\fIsr\fP" end="\fIer\fP"
267 Display expressions which start with the extended regular expression
268 \fIsr\fP and end with the extended regular expression \fIer\fP with
269 foreground color \fIfgcolor\fP and background color \fIbgcolor\fP,
270 at least one of which must be specified.  This allows syntax
271 highlighting to span multiple lines.  Note that all subsequent instances
272 of \fIsr\fP after an initial \fIsr\fP is found will be highlighted until
273 the first instance of \fIer\fP.
274 .TP
275 .B icolor \fIfgcolor\fP,\fIbgcolor\fP start="\fIsr\fP" end="\fIer\fP"
276 Same as above, except that the expression matching is case insensitive.
277 .TP
278 .B include "\fIsyntaxfile\fP"
279 Read in self-contained color syntaxes from \fIsyntaxfile\fP.  Note that
280 \fIsyntaxfile\fP can only contain \fBsyntax\fP, \fBcolor\fP, and
281 \fBicolor\fP commands.
282 .SH KEY BINDINGS
283 Key bindings may be reassigned via the following commands:
284 .TP
285 .B bind \fIkey\fP \fIfunction\fP  \fImenu\fP
286 Rebinds the key \fIkey\fP to a new function named \fIfunction\fP in the
287 context of menu \fImenu\fP.  The format of  \fIkey\fP should be one of:
288 .TP
289 .B ^ 
290 followed by an alpha character or the word "Space".
291 Example: ^C
292 .TP
293 .B M- 
294 followed by a printable character or the word "Space".
295 Example: M-C
296 .TP
297 .B F 
298 followed by a numeric value from 1 to 16.
299 Example: F10
300 .TP
301 Valid function names to be bound include:
302 .TP 3
303 .B help
304 Invoke the help menu.
305 .TP
306 .B cancel
307 Cancel the current command.
308 .TP
309 .B exit
310 Exit from the program.
311 .TP
312 .B writeout
313 Write the current buffer to disk.
314 .TP
315 .B justify
316 Justify the current text.
317 .TP
318 .B insert
319 Insert a file into the current buffer (or into a new buffer when multibuffer
320 is enabled).
321 .TP
322 .B whereis
323 Search for text in the current buffer.
324 .TP
325 .B searchagain
326 Repeat the last search command.
327 .TP
328 .B up
329 Move up in the editor or browser.
330 .TP
331 .B down
332 Move down in the editor or browser.
333 .TP
334 .B left
335 Move left in the editor or browser.
336 .TP
337 .B right
338 Move right in the editor or browser.
339 .TP
340 .B cut
341 Cut the current line of text and store it.
342 .TP
343 .B uncut
344 Copy the currently stored text into the current buffer position.
345 .TP
346 .B curpos
347 Show the current line, column, word positions in the file.
348 .TP
349 .B firstline
350 Move to the first line of the file.
351 .TP
352 .B lastline
353 Move to the last line of the file.
354 .TP
355 .B gotoline
356 Move to a specific line (and column if specified).
357 .TP
358 .B replace
359 Interactively replace text within the current buffer.
360 .TP
361 .B mark
362 Begin selecting text for cutting or pasting at the current position.
363 .TP
364 .B copytext
365 Copy the currently marked text without deleting it.
366 .TP
367 .B indent
368 Indent the currently marked text (shift to the right).
369 .TP
370 .B unindent
371 Un-indent the currently marked text (shift to the left).
372 .TP
373 .B nextword
374 Move the cursor to the beginning of the next word.
375 .TP
376 .B prevword
377 Move the cursor to the beginning of the previous word.
378 .TP
379 .B home
380 Move the cursor to the beginning of the current line.
381 .TP
382 .B end
383 Move the cursor to the end of the current line.
384 .TP
385 .B beginpara
386 Move the cursor to the beginning of the current paragraph.
387 .TP
388 .B endpara
389 Move the cursor to the end of the current paragraph.
390 .TP
391 .B findbracket
392 Move the cursor to the matching bracket (brace, parenthesis, etc.) of the one
393 under the cursor.
394 .TP
395 .B scrollup
396 Scroll up one line of text from the current position.
397 .TP
398 .B scrolldown
399 Scroll down one line of text from the current position.
400 .TP
401 .B prevbuf
402 Switch to editing/viewing the previous buffer when using multibuffer mode.
403 .TP
404 .B nextbuf
405 Switch to editing/viewing the next buffer when using multibuffer mode.
406 .TP
407 .B verbatim
408 Insert the next character verbatim into the file.
409 .TP
410 .B tab
411 Insert a tab at the current cursor location.
412 .TP
413 .B enter
414 Insert a new line below the current one.
415 .TP
416 .B delete
417 Delete the character under the cursor.
418 .TP
419 .B fulljustify
420 Justify the entire current file.
421 .TP
422 .B wordcount
423 Count the number of words in the current buffer.
424 .TP
425 .B refresh
426 Refresh the screen.
427 .TP
428 .B undo
429 Undo the text action peformed (add text, delete text, etc).
430 .TP
431 .B redo
432 Redo the last undone action (i.e., undo an undo).
433 .TP
434 .B suspend
435 Suspend the editor (if the suspend function is enabled, see the 
436 "suspendenable" entry below).
437 .TP
438 .B casesens
439 Toggle case sensitivity in searching (search/replace menus only).
440 .TP
441 .B regexp
442 Toggle whether searching/replacing is based on literal strings or regular expressions.
443 .TP
444 .B prevhistory
445 Show the previous history entry in the prompt menus (e.g. search).
446 .TP
447 .B nexthistory
448 Show the next history entry in the prompt menus (e.g. search).
449 .TP
450 .B dontreplace
451 Switch back to searching instead of replacing.
452 .TP
453 .B gototext
454 Search for files matching a string in the file browser (reading or writing files).
455 .TP
456 .B dosformat
457 When writing a file, switch to writing a DOS format (CR/LF).
458 .TP
459 .B macformat
460 When writing a file, switch to writing a Mac format.
461 .TP
462 .B append
463 When writing a file, append to the end instead of overwriting.
464 .TP
465 .B prepend
466 When writing a file, 'prepend' (write at the beginning) instead of overwriting.
467 .TP
468 .B backup
469 When writing a file, create a backup of the current file. 
470 .TP
471 .B firstfile
472 Move to the first file when using the file browser (reading or writing files).
473 .TP
474 .B lastfile
475 Move to the last file when using the file browser (reading or writing files).
476 .TP
477 .B nohelp
478 Toggle showing/hiding the two-line list of key bindings at the bottom of the screen.
479 .TP
480 .B constupdate
481 Constantly display the current line, column, word positions.
482 .TP
483 .B morespace
484 Toggle showing/hiding the blank line which 'separates' the 'title' from the file text.
485 .TP
486 .B smoothscroll
487 Toggle smooth scrolling when moving via the arrow keys.
488 .TP
489 .B whitespacedisplay
490 Toggle whether whitespace is shown.
491 .TP
492 .B smarthome
493 Toggle whether the smart home key function is enabled.
494 .TP
495 .B autoindent
496 Toggle whether new lines will contain the same amount of whitespace as the line above.
497 .TP
498 .B cuttoend
499 Toggle whether cutting text will cut the whole line or just from the current cursor
500 position to the end of the line.
501 .TP
502 .B nowrap
503 Toggle whether long lines will be wrapped to the next line.
504 .TP
505 .B suspendenable
506 Toggle whether the suspend sequence (normally ^Z) will suspend the editor window.
507 .TP
508
509 Valid menu sections are:
510 .TP
511 .B main
512 The main editor window where text is entered.
513 .TP
514 .B search
515 The search menu (AKA whereis).
516 .TP
517 .B replace
518 The 'search to replace' menu.
519 .TP
520 .B replacewith
521 The 'replace with' menu, which comes up after 'search to replace'.
522 .TP
523 .B gotoline
524 The 'goto line (and column)' menu.
525 .TP
526 .B writeout
527 The 'write file' menu.
528 .TP
529 .B insert
530 The 'insert file' menu.
531 .TP
532 .B extcmd
533 The menu for inserting output from an external comman, reached from the insert menu.
534 .TP
535 .B help
536 The help menu.
537 .TP
538 .B spell
539 The interactive spell checker Yes/no menu.
540 .TP
541 .B browser
542 The file browser for inserting or writing a file.
543 .TP
544 .B whereisfile
545 The 'search for a file' menu in the file browser.
546 .TP
547 .B gotodir
548 The 'go to directory' menu.
549 .TP
550 .B all
551 A special name meaning: apply to all menus where this function exists.
552
553 .TP
554 .B unbind \fIkey\fP \fImenu\fP
555 Unbind the key \fIkey\fP from the menu named \fImenu\fP or from all 
556 menus by using \fIall\fP.  Same key syntax as for binding.
557 Rebinds the key \fIkey\fP to a new function named \fIfunction\fP in the
558 context of menu \fImenu\fP.  The format of  \fIkey\fP should be one of:
559 .SH FILES
560 .TP
561 .I SYSCONFDIR/nanorc
562 System-wide configuration file
563 .TP
564 .I ~/.nanorc
565 Per-user configuration file
566 .SH SEE ALSO
567 .PD 0
568 .TP
569 \fBnano\fP(1)
570 .PP
571 \fI/usr/share/doc/nano/examples/nanorc.sample\fP (or equivalent on your
572 system)
573 .SH AUTHOR
574 Chris Allegretta <chrisa@asty.org>, et al (see \fIAUTHORS\fP and
575 \fITHANKS\fP for details).  This manual page was originally written by
576 Jordi Mallach <jordi@gnu.org>, for the Debian system (but may be used by
577 others).