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