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