nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

nano.texi (79696B)


      1 \input texinfo
      2 
      3 @c %**start of header
      4 @setfilename nano.info
      5 @settitle The GNU nano text editor
      6 @c %**end of header
      7 
      8 @documentencoding UTF-8
      9 
     10 @documentdescription
     11 The complete manual for the GNU nano text editor.
     12 @end documentdescription
     13 
     14 @smallbook
     15 @set EDITION 0.8
     16 @set VERSION 8.5
     17 @set UPDATED June 2025
     18 
     19 @dircategory Editors
     20 @direntry
     21 * nano: (nano).                 Small and friendly text editor.
     22 @end direntry
     23 
     24 @comment Prevent the black square at the end of an overlong line.
     25 @finalout
     26 
     27 
     28 @titlepage
     29 
     30 @title GNU @command{nano}
     31 @subtitle a small and friendly text editor
     32 @subtitle version 8.5
     33 
     34 @author Chris Allegretta
     35 
     36 @page
     37 
     38 This manual documents the GNU @command{nano} text editor.
     39 @sp 1
     40 The contents of this manual are part of the GNU @command{nano} distribution.
     41 
     42 @sp 5
     43 Copyright @copyright{} 1999-2009, 2014-2025 Free Software Foundation, Inc.
     44 @sp 1
     45 This document is dual-licensed.  You may distribute and/or modify it
     46 under the terms of either of the following licenses:
     47 @sp 1
     48 * The GNU General Public License, as published by the Free Software
     49   Foundation, version 3 or (at your option) any later version.  You
     50   should have received a copy of the GNU General Public License along
     51   with this program.  If not, see @url{https://www.gnu.org/licenses/}.
     52 @sp 1
     53 * The GNU Free Documentation License, as published by the Free Software
     54   Foundation, version 1.2 or (at your option) any later version, with no
     55   Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
     56   You should have received a copy of the GNU Free Documentation License
     57   along with this program.  If not, see @url{https://www.gnu.org/licenses/}.
     58 
     59 @sp 5
     60 You may contact the original author by e-mail: @email{chrisa@@asty.org}
     61 
     62 Or contact the current maintainer: @email{bensberg@@coevern.nl}
     63 
     64 @sp 1
     65 For suggesting improvements: @email{nano-devel@@gnu.org}
     66 
     67 @end titlepage
     68 
     69 
     70 @macro blankline
     71 @iftex
     72 @sp 1
     73 @end iftex
     74 @end macro
     75 
     76 
     77 @ifnottex
     78 
     79 @node Top
     80 @top
     81 
     82 This manual documents GNU @command{nano}, version 8.5.
     83 
     84 @menu
     85 * Introduction::
     86 * Invoking::
     87 * Editor Basics::
     88 * The Help Viewer::
     89 * The File Browser::
     90 * Command-line Options::
     91 * Feature Toggles::
     92 * Nanorc Files::
     93 * Pico Compatibility::
     94 * Building and its Options::
     95 @end menu
     96 
     97 @end ifnottex
     98 
     99 
    100 @node Introduction
    101 @chapter Introduction
    102 
    103 GNU @command{nano} is a small and friendly text editor.  Besides
    104 basic text editing, @command{nano} offers features like undo/redo,
    105 syntax coloring, interactive search-and-replace, auto-indentation,
    106 line numbers, word completion, file locking, backup files, and
    107 internationalization support.
    108 
    109 The original goal for @command{nano} was to be a complete bug-for-bug
    110 emulation of Pico.  But currently the goal is to be as compatible
    111 as is reasonable while offering a superset of Pico's functionality.
    112 @xref{Pico Compatibility} for more details on how @command{nano} and
    113 Pico differ.
    114 
    115 @blankline
    116 Since version 4.0, @command{nano} no longer hard-wraps overlong
    117 lines by default.  It also by default uses linewise scrolling, and by
    118 default includes the line below the title bar in the editing area.
    119 In case you want the old, Pico behavior back, you can use the
    120 following options: @option{--breaklonglines},
    121 @option{--jumpyscrolling}, and @option{--emptyline}
    122 (or @option{-bje}).
    123 
    124 @blankline
    125 Since version 8.0, @kbd{^F} starts a forward search, @kbd{^B} starts
    126 a backward search, @kbd{M-F} searches the next occurrence forward,
    127 and @kbd{M-B} searches the next occurrence backward.  If you want
    128 those keystrokes to do what they did before version 8.0, see the
    129 rebindings in the sample nanorc file.
    130 
    131 @blankline
    132 Please report bugs via @url{https://savannah.gnu.org/bugs/?group=nano}.
    133 
    134 @blankline
    135 Questions about using nano you can ask at @email{help-nano@@gnu.org}.
    136 
    137 @blankline
    138 For background information see @url{https://nano-editor.org/}.
    139 
    140 
    141 @node Invoking
    142 @chapter Invoking
    143 
    144 The usual way to invoke @command{nano} is:
    145 
    146 @blankline
    147 @example
    148 @code{nano [FILE]}
    149 @end example
    150 @blankline
    151 
    152 But it is also possible to specify one or more options (@pxref{Command-line Options}),
    153 and to edit several files in a row.
    154 
    155 The cursor can be put on a specific line of a file by adding
    156 the line number with a plus sign before the filename, and even
    157 in a specific column by adding it with a comma.
    158 Negative numbers count from the end of the file or line.
    159 
    160 The cursor can be put on the first or last occurrence of a specific string
    161 by specifying that string after @code{+/} or @code{+?} before the filename.
    162 The string can be made case sensitive and/or caused to be interpreted as a
    163 regular expression by inserting a @code{c} and/or @code{r} after the plus sign.
    164 These search modes can be explicitly disabled by using the uppercase variant
    165 of those letters: @code{C} and/or @code{R}.  When the string contains spaces,
    166 it needs to be enclosed in quotes.
    167 A more complete command synopsis thus is:
    168 
    169 @blankline
    170 @example
    171 @code{nano [OPTION]@dots{} [[+LINE[,COLUMN]|+[crCR]@{/|?@}STRING] FILE]@dots{}}
    172 @end example
    173 @blankline
    174 
    175 Normally, however, you set your preferred options in a @file{nanorc}
    176 file (@pxref{Nanorc Files}).  And when using @code{set positionlog}
    177 (making @command{nano} remember the cursor position when you close a file),
    178 you will rarely need to specify a line number.
    179 
    180 As a special case: when instead of a filename a dash is given, @command{nano}
    181 will read data from standard input.  This means you can pipe the output of
    182 a command straight into a buffer, and then edit it.
    183 
    184 
    185 @node Editor Basics
    186 @chapter Editor Basics
    187 
    188 @menu
    189 * Screen Layout::
    190 * Entering Text::
    191 * Commands::
    192 * The Cutbuffer::
    193 * The Mark::
    194 * Search and Replace::
    195 * Using the Mouse::
    196 * Anchors::
    197 * Limitations::
    198 @end menu
    199 
    200 @node Screen Layout
    201 @section Screen Layout
    202 
    203 The default screen of @command{nano} consists of four areas.
    204 From top to bottom these are: the title bar, the edit window,
    205 the status bar, and two help lines.
    206 
    207 The title bar consists of
    208 three sections: left, center and right.  The section on the left
    209 displays the version of @command{nano} being used.  The center section
    210 displays the current filename, or "New Buffer" if the file has not yet
    211 been named.  The section on the right displays "Modified" if the
    212 file has been modified since it was last saved or opened.
    213 
    214 The status bar is the third line from the bottom of the screen.  It
    215 shows important and informational messages.  Any error messages that
    216 occur from using the editor appear on the status bar.  Any questions
    217 that are asked of the user are asked on the status bar, and any user
    218 input (search strings, filenames, etc.) is input on the status bar.
    219 
    220 The two help lines at the bottom of the screen show some of the most
    221 essential functions of the editor.
    222 
    223 @node Entering Text
    224 @section Entering Text
    225 
    226 @command{nano} is a "modeless" editor.  This means that all keystrokes,
    227 with the exception of Control and Meta sequences, enter text into the
    228 file being edited.
    229 
    230 Characters not present on the keyboard can be entered in two ways:
    231 
    232 @itemize @bullet
    233 @item
    234 For characters with a single-byte code,
    235 pressing the Esc key twice and then typing a three-digit decimal number
    236 (from @kbd{000} to @kbd{255}) makes @command{nano} behave as if you
    237 typed the key with that value.
    238 
    239 @item
    240 For any possible character, pressing @kbd{M-V} (Alt+V) and then typing a
    241 series of hexadecimal digits (at most six, or concluded with @kbd{Enter} or
    242 @kbd{Space}) enters the corresponding Unicode character into the buffer.
    243 @end itemize
    244 
    245 For example, typing @kbd{Esc Esc 2 3 4} enters the character "ê" ---
    246 useful when writing about a French party.  Typing @kbd{M-V 0 0 2 2 c 4}
    247 enters the symbol "⋄", a little diamond.
    248 
    249 Typing @kbd{M-V} followed by anything other than a hexadecimal digit
    250 enters this keystroke verbatim into the buffer, allowing the user
    251 to insert literal control codes (except @code{^J}) or escape sequences.
    252 
    253 @node Commands
    254 @section Commands
    255 
    256 Commands are given by using the Control key (Ctrl, shown as @kbd{^})
    257 or the Meta key (Alt or Cmd, shown as @kbd{M-}).
    258 
    259 @itemize @bullet
    260 @item
    261 A control-key sequence is entered by holding down the Ctrl key and
    262 pressing the desired key.
    263 
    264 @item
    265 A meta-key sequence is entered by holding down the Meta key (normally
    266 the Alt key) and pressing the desired key.
    267 @end itemize
    268 
    269 If for some reason on your system the combinations with Ctrl or Alt do
    270 not work, you can generate them by using the Esc key.  A control-key
    271 sequence is generated by pressing the Esc key twice and then pressing
    272 the desired key, and a meta-key sequence by pressing the Esc key once
    273 and then pressing the desired key.
    274 
    275 @node The Cutbuffer
    276 @section The Cutbuffer
    277 
    278 Text can be cut from a file a whole line at a time with @kbd{^K}.
    279 The cut line is stored in the cutbuffer.  Consecutive strokes of @kbd{^K}
    280 add each cut line to this buffer, but a @kbd{^K}
    281 after any other keystroke overwrites the entire cutbuffer.
    282 
    283 The contents of the cutbuffer can be pasted at the current cursor position
    284 with @kbd{^U}.
    285 
    286 A line of text can be copied into the cutbuffer (without cutting it)
    287 with @kbd{M-6}.
    288 
    289 @node The Mark
    290 @section The Mark
    291 
    292 Text can be selected by first 'setting the Mark' with @kbd{^6}
    293 or @kbd{M-A} and then moving the cursor to the other end of the portion
    294 to be selected.  The selected portion of text is highlighted.
    295 This selection can now be cut or copied in its entirety with a single
    296 @kbd{^K} or @kbd{M-6}.  Or the selection can be used to limit the scope of
    297 a search-and-replace (@kbd{^\}) or spell-checking session (@kbd{^T^T}).
    298 
    299 On some terminals, text can be selected also by holding down @kbd{Shift}
    300 while using the cursor keys.  Holding down the @kbd{Ctrl} or @kbd{Alt}
    301 key too increases the stride.  Such a selection is cancelled
    302 upon any cursor movement where @kbd{Shift} isn't held.
    303 
    304 Cutting or copying selected text toggles off the mark automatically.
    305 If needed, it can be toggled off manually with another @kbd{^6} or @kbd{M-A}.
    306 
    307 @node Search and Replace
    308 @section Search and Replace
    309 
    310 With the Search command (@kbd{^F} or @kbd{^W}) one can search the
    311 current buffer for the occurrence of any string.  The default search
    312 mode is forward, case-insensitive, and for literal strings.  But one
    313 can search backwards by toggling @kbd{M-B}, search case sensitively
    314 with @kbd{M-C}, and interpret regular expressions in the search string
    315 with @kbd{M-R}.
    316 
    317 With the Replacement command (@kbd{M-R} or @kbd{^\}) one can replace
    318 a given string (or regular expression) with another string.
    319 When a regular expression contains fragments between parentheses,
    320 the replacement string can refer back to these fragments via
    321 @code{\1} to @code{\9}.
    322 
    323 For each occurrence of the search string you are asked whether to
    324 replace it.  You can choose Yes (replace it), or No (skip this one),
    325 or All (replace all remaining occurrences without asking any more),
    326 or Cancel (stop with replacing, but replacements that have already
    327 been made will not be undone).
    328 
    329 If before a replacing session starts a region is marked, then
    330 only occurrences of the search string within the marked region
    331 will be replaced.
    332 
    333 A regular expression always covers just one line --- it cannot span
    334 multiple lines.  And neither a search string nor a replacement string
    335 can contain a newline (LF).
    336 
    337 @node Using the Mouse
    338 @section Using the Mouse
    339 
    340 When mouse support has been configured and enabled, a single mouse click
    341 places the cursor at the indicated position.  Clicking a second time in
    342 the same position toggles the mark.  Clicking in the two help lines
    343 executes the selected shortcut.  To be able to select text with the
    344 left button, or paste text with the middle button, hold down the
    345 Shift key during those actions.
    346 
    347 The mouse works in the X Window System, and on the console when gpm
    348 is running.
    349 
    350 @node Anchors
    351 @section Anchors
    352 
    353 With @kbd{M-Ins} you can place an anchor (a kind of bookmark) at
    354 the current line.  With @kbd{M-PgUp} and @kbd{M-PgDn} you can jump
    355 to an anchor in the backward/forward direction.  This jumping wraps
    356 around at the top and bottom.
    357 
    358 When an operation removes a line with an anchor, the new line with the
    359 cursor inherits the anchor.  But after performing an operation on the
    360 entire buffer (like formatting it, piping it through a command, or
    361 doing an external spell check on it), any anchors that were present
    362 are gone.
    363 
    364 When @option{--positionlog} or @code{set positionlog} is active, anchors
    365 are saved when the file is closed, and restored when the file is reopened.
    366 
    367 Anchors are visualized in the left margin if line numbers are active,
    368 and are always visualized (on the right-hand side) in the mini bar.
    369 
    370 @node Limitations
    371 @section Limitations
    372 
    373 The recording and playback of keyboard macros works correctly only on a
    374 terminal emulator, not on a Linux console (VT), because the latter does
    375 not by default distinguish modified from unmodified arrow keys.
    376 
    377 
    378 @node The Help Viewer
    379 @chapter The Help Viewer
    380 
    381 The built-in help in @command{nano} is available by pressing @kbd{^G}.
    382 It is fairly self-explanatory.  It documents the various parts of the
    383 editor and the available keystrokes.  Navigation is via the @kbd{^Y} (Page Up)
    384 and @kbd{^V} (Page Down) keys.  @kbd{^X} exits from the help viewer.
    385 
    386 
    387 @node The File Browser
    388 @chapter The File Browser
    389 
    390 When in the Read-File (@kbd{^R}) or Write-Out menu (@kbd{^O}),
    391 pressing @kbd{^T} invokes the file browser.
    392 Here, one can navigate directories in a graphical manner in order to
    393 find the desired file.
    394 
    395 Basic movement in the file browser is accomplished with the arrow and
    396 other cursor-movement keys.  More targeted movement is accomplished by
    397 searching, via @kbd{^W} or @kbd{w}, or by changing directory, via
    398 @kbd{^_} or @kbd{g}.  The behavior of the @kbd{Enter} key (or @kbd{s})
    399 varies by what is currently selected.
    400 If the currently selected object is a directory, the file browser
    401 enters and displays the contents of the directory.  If the object is a
    402 file, this filename and path are copied to the status bar, and the file
    403 browser exits.
    404 
    405 
    406 @node Command-line Options
    407 @chapter Command-line Options
    408 
    409 @command{nano} accepts the following options from the command line:
    410 
    411 @table @option
    412 
    413 @item -A
    414 @itemx --smarthome
    415 Make the Home key smarter.  When Home is pressed anywhere but at the
    416 very beginning of non-whitespace characters on a line, the cursor jumps
    417 to that beginning (either forwards or backwards).  If the cursor is
    418 already at that position, it jumps to the true beginning of the line.
    419 
    420 @item -B
    421 @itemx --backup
    422 When saving a file, back up the previous version of it, using the current
    423 filename suffixed with a tilde (@code{~}).
    424 
    425 @item -C @var{directory}
    426 @itemx --backupdir=@var{directory}
    427 Make and keep not just one backup file, but make and keep a uniquely
    428 numbered one every time a file is saved --- when backups are enabled.
    429 The uniquely numbered files are stored in the specified directory.
    430 
    431 @item -D
    432 @itemx --boldtext
    433 For the interface, use bold instead of reverse video.
    434 This can be overridden for specific elements
    435 by setting the options @code{titlecolor}, @code{statuscolor},
    436 @code{promptcolor}, @code{minicolor}, @code{keycolor},
    437 @code{numbercolor}, and/or @code{selectedcolor} in your
    438 nanorc file.  @xref{@code{set keycolor}} for details.
    439 
    440 @item -E
    441 @itemx --tabstospaces
    442 Convert each typed tab to spaces --- to the number of spaces
    443 that a tab at that position would take up.
    444 (Note: pasted tabs are not converted.)
    445 
    446 @item -F
    447 @itemx --multibuffer
    448 Read a file into a new buffer by default.
    449 
    450 @item -G
    451 @itemx --locking
    452 Enable vim-style file locking when editing files.
    453 
    454 @item -H
    455 @itemx --historylog
    456 Save the last hundred search strings and replacement strings and
    457 executed commands, so they can be easily reused in later sessions.
    458 
    459 @item -I
    460 @itemx --ignorercfiles
    461 Don't look at the system's nanorc file nor at the user's nanorc.
    462 
    463 @item -J
    464 @itemx --guidestripe
    465 Draw a vertical stripe at the given column, to help judge the width of the
    466 text.  (The color of the stripe can be changed with @code{set stripecolor}
    467 in your nanorc file.)
    468 
    469 @item -K
    470 @itemx --rawsequences
    471 Interpret escape sequences directly, instead of asking @code{ncurses}
    472 to translate them.  (If you need this option to get some keys to work
    473 properly, it means that the terminfo terminal description that is used
    474 does not fully match the actual behavior of your terminal.  This can
    475 happen when you ssh into a BSD machine, for example.)
    476 Using this option disables @command{nano}'s mouse support.
    477 
    478 @item -L
    479 @itemx --nonewlines
    480 Don't automatically add a newline when a text does not end with one.
    481 (This can cause you to save non-POSIX text files.)
    482 
    483 @item -M
    484 @itemx --trimblanks
    485 Snip trailing whitespace from the wrapped line when automatic
    486 hard-wrapping occurs or when text is justified.
    487 
    488 @item -N
    489 @itemx --noconvert
    490 Disable automatic conversion of files from DOS/Mac format.
    491 
    492 @item -O
    493 @itemx --bookstyle
    494 When justifying, treat any line that starts with whitespace as the
    495 beginning of a paragraph (unless auto-indenting is on).
    496 
    497 @item -P
    498 @itemx --positionlog
    499 For the 200 most recent files, log the last position of the cursor,
    500 and place it at that position again upon reopening such a file.
    501 Also save and restore the positions of any anchors.
    502 
    503 @item -Q "@var{regex}"
    504 @itemx --quotestr="@var{regex}"
    505 Set the regular expression for matching the quoting part of a line.
    506 The default value is "@t{^([@w{ }\t]*([!#%:;>|@}]|//))+}".
    507 (Note that @code{\t} stands for a literal Tab character.)
    508 This makes it possible to rejustify blocks of quoted text when composing
    509 email, and to rewrap blocks of line comments when writing source code.
    510 
    511 @item -R
    512 @itemx --restricted
    513 Restricted mode: don't read or write to any file not specified on the
    514 command line.  This means: don't read or write history files; don't allow
    515 suspending; don't allow spell checking; don't
    516 allow a file to be appended to, prepended to, or saved under a different
    517 name if it already has one; and don't make backup files.
    518 Restricted mode can also be activated by invoking @command{nano} with
    519 any name beginning with @code{r} (e.g.@: @command{rnano}).
    520 
    521 @item -S
    522 @itemx --softwrap
    523 Display over multiple screen rows lines that exceed the screen's width.
    524 (You can make this soft-wrapping occur at whitespace instead of rudely at
    525 the screen's edge, by using also @code{--atblanks}.)
    526 
    527 @item -T @var{number}
    528 @itemx --tabsize=@var{number}
    529 Set the displayed tab length to @var{number} columns.  The value of
    530 @var{number} must be greater than 0.  The default value is @t{8}.
    531 
    532 @item -U
    533 @itemx --quickblank
    534 Make status-bar messages disappear after 1 keystroke instead of after 20.
    535 Note that option @option{-c} (@option{--constantshow}) overrides this.
    536 When option @option{--minibar} or @option{--zero} is in effect,
    537 @option{--quickblank} makes a message disappear after
    538 0.8 seconds instead of after the default 1.5 seconds.
    539 
    540 @item -V
    541 @itemx --version
    542 Show the current version number and exit.
    543 
    544 @item -W
    545 @itemx --wordbounds
    546 Detect word boundaries differently by treating punctuation
    547 characters as parts of words.
    548 
    549 @item -X "@var{characters}"
    550 @itemx --wordchars="@var{characters}"
    551 Specify which other characters (besides the normal alphanumeric ones)
    552 should be considered as parts of words.  When using this option, you
    553 probably want to omit @option{-W} (@option{--wordbounds}).
    554 
    555 @item -Y @var{name}
    556 @itemx --syntax=@var{name}
    557 Specify the syntax to be used for highlighting.
    558 @xref{Syntax Highlighting} for more info.
    559 
    560 @item -Z
    561 @itemx --zap
    562 Let an unmodified @kbd{Backspace} or @kbd{Delete} erase the marked region
    563 (instead of a single character, and without affecting the cutbuffer).
    564 
    565 @item -a
    566 @itemx --atblanks
    567 When doing soft line wrapping, wrap lines at whitespace
    568 instead of always at the edge of the screen.
    569 
    570 @item -b
    571 @itemx --breaklonglines
    572 Automatically hard-wrap the current line when it becomes overlong.
    573 (This option is the opposite of @option{-w} (@option{--nowrap}) ---
    574 the last one given takes effect.)
    575 
    576 @item -c
    577 @itemx --constantshow
    578 Constantly report the cursor position (line number, column number,
    579 and character number) on the status bar.
    580 Note that this overrides option @option{-U} (@option{--quickblank}).
    581 
    582 @item -d
    583 @itemx --rebinddelete
    584 Interpret the @kbd{Delete} and @kbd{Backspace} keys differently so that
    585 both work properly.  You should only use this option when on your system
    586 either @kbd{Backspace} acts like Delete or @kbd{Delete} acts like Backspace.
    587 
    588 @item -e
    589 @itemx --emptyline
    590 Do not use the line below the title bar, leaving it entirely blank.
    591 
    592 @item -f @var{file}
    593 @itemx --rcfile=@var{file}
    594 Read only this @var{file} for setting nano's options, instead of reading
    595 both the system-wide and the user's nanorc files.
    596 
    597 @item -g
    598 @itemx --showcursor
    599 Make the cursor visible in the file browser (putting it on the
    600 highlighted item) and in the help viewer.  Useful for braille users
    601 and people with poor vision.
    602 
    603 @item -h
    604 @itemx --help
    605 Show a summary of command-line options and exit.
    606 
    607 @item -i
    608 @itemx --autoindent
    609 Automatically indent a newly created line to the same number of tabs
    610 and/or spaces as the previous line (or as the next line if the previous
    611 line is the beginning of a paragraph).
    612 
    613 @item -j
    614 @itemx --jumpyscrolling
    615 Scroll the buffer contents per half-screen instead of per line.
    616 
    617 @item -k
    618 @itemx --cutfromcursor
    619 Make the 'Cut Text' command (normally @kbd{^K}) cut from the current cursor
    620 position to the end of the line, instead of cutting the entire line.
    621 
    622 @item -l
    623 @itemx --linenumbers
    624 Display line numbers to the left of the text area.
    625 (Any line with an anchor additionally gets a mark in the margin.)
    626 
    627 @item -m
    628 @itemx --mouse
    629 Enable mouse support, if available for your system.  When enabled, mouse
    630 clicks can be used to place the cursor, set the mark (with two clicks),
    631 and execute shortcuts.  The mouse works in the X Window System, and on
    632 the console when gpm is running.  Text can still be selected through
    633 dragging by holding down the Shift key.
    634 
    635 @item -n
    636 @itemx --noread
    637 Treat any name given on the command line as a new file.  This allows
    638 @command{nano} to write to named pipes: it starts with a blank buffer,
    639 and writes to the pipe when the user saves the "file".  This way
    640 @command{nano} can be used as an editor in combination with for instance
    641 @command{gpg} without having to write sensitive data to disk first.
    642 
    643 @item -o @var{directory}
    644 @itemx --operatingdir=@var{directory}
    645 Change to the given @var{directory}, and allow reading and writing
    646 files only in this directory and its subdirectories.
    647 
    648 @item -p
    649 @itemx --preserve
    650 Preserve the @kbd{^S} (XOFF) and @kbd{^Q} (XON) sequences so that
    651 data being sent to the terminal can be stopped and resumed.
    652 Note that option @option{-/} (@option{--modernbindings}) overrides this.
    653 
    654 @item -q
    655 @itemx --indicator
    656 Display a "scrollbar" on the righthand side of the edit window.
    657 It shows the position of the viewport in the buffer
    658 and how much of the buffer is covered by the viewport.
    659 
    660 @item -r @var{number}
    661 @itemx --fill=@var{number}
    662 Set the target width for justifying and automatic hard-wrapping at this
    663 @var{number} of columns.  If the value is 0 or less, wrapping occurs
    664 at the width of the screen minus @var{number} columns, allowing the wrap
    665 point to vary along with the width of the screen if the screen is resized.
    666 The default value is @t{-8}.
    667 
    668 @anchor{@option{--speller}}
    669 @item -s "@var{program} [@var{argument} @dots{}]"
    670 @itemx --speller="@var{program} [@var{argument} @dots{}]"
    671 Use the given program to do spell checking and correcting.  By default,
    672 @command{nano} uses the command specified in the @env{SPELL} environment
    673 variable.  If @env{SPELL} is not set, and @option{--speller} is
    674 not specified either, then @command{nano} uses its own interactive spell
    675 corrector, which requires either @command{hunspell} or GNU @command{spell}
    676 to be installed.
    677 
    678 @item -t
    679 @itemx --saveonexit
    680 Save a changed buffer without prompting (when exiting with @kbd{^X}).
    681 This can be handy when @command{nano} is used as the composer of an
    682 email program.
    683 
    684 @item -u
    685 @item --unix
    686 Save a file by default in Unix format.  This overrides nano's
    687 default behavior of saving a file in the format that it had.
    688 (This option has no effect when you also use @option{--noconvert}.)
    689 
    690 @item -v
    691 @itemx --view
    692 Don't allow the contents of the file to be altered: read-only mode.
    693 This mode allows the user to open also other files for viewing,
    694 unless @option{--restricted} is given too.
    695 (Note that this option should NOT be used in place of correct
    696 file permissions to implement a read-only file.)
    697 
    698 @item -w
    699 @itemx --nowrap
    700 Do not automatically hard-wrap the current line when it becomes overlong.
    701 This is the default.  (This option is the opposite of @option{-b}
    702 (@option{--breaklonglines}) --- the last one given takes effect.)
    703 
    704 
    705 @item -x
    706 @itemx --nohelp
    707 Expert mode: don't show the two help lines at the bottom of the screen.
    708 This affects the location of the status bar as well, as in Expert mode it
    709 is located at the very bottom of the editor.
    710 
    711 Note: When accessing the help system, Expert mode is temporarily
    712 disabled to display the help-system navigation keys.
    713 
    714 @item -y
    715 @itemx --afterends
    716 Make @kbd{Ctrl+Right} and @kbd{Ctrl+Delete} stop at word ends
    717 instead of beginnings.
    718 
    719 @item -z
    720 @itemx --listsyntaxes
    721 List the names of the available syntaxes and exit.
    722 
    723 @item -!
    724 @itemx --magic
    725 When neither the file's name nor its first line give a clue,
    726 try using libmagic to determine the applicable syntax.
    727 
    728 @item -@@
    729 @itemx --colonparsing
    730 When a filename given on the command line ends in a colon plus digits
    731 and this filename does not exist, then snip the colon plus digits and
    732 understand the digits as a line number.  If the trimmed filename does
    733 not exist either, then repeat the process and understand the obtained
    734 two numbers as line and column number.  But if the doubly trimmed
    735 filename does not exist either, then forget the trimming and accept
    736 the original filename as is.  To disable this colon parsing for some
    737 file, use @code{+1} or similar before the relevant filename.
    738 
    739 @item -%
    740 @itemx --stateflags
    741 Use the top-right corner of the screen for showing some state flags:
    742 @code{I} when auto-indenting, @code{M} when the mark is on, @code{L} when
    743 hard-wrapping (breaking long lines), @code{R} when recording a macro,
    744 and @code{S} when soft-wrapping.
    745 When the buffer is modified, a star (@code{*}) is shown after the
    746 filename in the center of the title bar.
    747 
    748 @item -_
    749 @itemx --minibar
    750 Suppress the title bar and instead show information about
    751 the current buffer at the bottom of the screen, in the space
    752 for the status bar.  In this "mini bar" the filename is shown
    753 on the left, followed by an asterisk if the buffer has been modified.
    754 On the right are displayed the current line and column number, the
    755 code of the character under the cursor (in Unicode format: U+xxxx),
    756 the same flags as are shown by @code{--stateflags}, and a percentage
    757 that expresses how far the cursor is into the file (linewise).
    758 When a file is loaded or saved, and also when switching between buffers,
    759 the number of lines in the buffer is displayed after the filename.
    760 This number is cleared upon the next keystroke, or replaced with an
    761 [i/n] counter when multiple buffers are open.
    762 The line plus column numbers and the character code are displayed only when
    763 @code{--constantshow} is used, and can be toggled on and off with @kbd{M-C}.
    764 The state flags are displayed only when @code{--stateflags} is used.
    765 
    766 @item -0
    767 @itemx --zero
    768 Hide all elements of the interface (title bar, status bar, and help lines)
    769 and use all rows of the terminal for showing the contents of the buffer.
    770 The status bar appears only when there is a significant message,
    771 and disappears after 1.5 seconds or upon the next keystroke.
    772 With @kbd{M-Z} the title bar plus status bar can be toggled.
    773 With @kbd{M-X} the help lines.
    774 
    775 @item -/
    776 @itemx --modernbindings
    777 Use key bindings similar to the ones that most modern programs use:
    778 @kbd{^X} cuts, @kbd{^C} copies, @kbd{^V} pastes,
    779 @kbd{^Z} undoes, @kbd{^Y} redoes,
    780 @kbd{^F} searches forward, @kbd{^G} searches next,
    781 @kbd{^S} saves, @kbd{^O} opens a file, @kbd{^Q} quits,
    782 and (when the terminal permits) @kbd{^H} shows help.
    783 Furthermore, @kbd{^A} sets the mark,
    784 @kbd{^R} makes replacements, @kbd{^D} searches previous,
    785 @kbd{^P} shows the position, @kbd{^T} goes to a line,
    786 @kbd{^W} writes out a file, and @kbd{^E} executes a command.
    787 Note that this overrides option @option{-p} (@option{--preserve}).
    788 
    789 @end table
    790 
    791 @sp 1
    792 Suspension is enabled by default, reachable via @kbd{^T^Z}.
    793 (If you want a plain @kbd{^Z} to suspend nano, add
    794 @code{bind ^Z suspend main} to your nanorc.)
    795 
    796 
    797 @node Feature Toggles
    798 @chapter Feature Toggles
    799 
    800 Toggles allow you to change certain aspects of the editor while you are
    801 editing, aspects that you would normally specify via command-line options
    802 or nanorc options.  Each toggle can be flicked via a Meta-key combination
    803 --- the @kbd{Meta} key is normally the @kbd{Alt} key (@pxref{Commands}
    804 for more details).  The following global toggles are available:
    805 
    806 @sp 1
    807 @table @code
    808 
    809 @item Constant Cursor Position Display
    810 @kbd{M-C} toggles the @option{-c} (@option{--constantshow}) command-line option.
    811 
    812 @item Smart Home Key
    813 @kbd{M-H} toggles the @option{-A} (@option{--smarthome}) command-line option.
    814 
    815 @item Auto Indent
    816 @kbd{M-I} toggles the @option{-i} (@option{--autoindent}) command-line option.
    817 
    818 @item Cut From Cursor To End-of-Line
    819 @kbd{M-K} toggles the @option{-k} (@option{--cutfromcursor}) command-line option.
    820 
    821 @item Long-Line Wrapping
    822 @kbd{M-L} toggles the @option{-b} (@option{--breaklonglines}) command-line option.
    823 
    824 @item Mouse Support
    825 @kbd{M-M} toggles the @option{-m} (@option{--mouse}) command-line option.
    826 
    827 @item Line Numbers
    828 @kbd{M-N} toggles the @option{-l} (@option{--linenumbers}) command-line option.
    829 
    830 @item Tabs To Spaces
    831 @kbd{M-O} toggles the @option{-E} (@option{--tabstospaces}) command-line option.
    832 
    833 @item Whitespace Display
    834 @kbd{M-P} toggles the displaying of whitespace (@pxref{Whitespace}).
    835 
    836 @item Soft Wrapping
    837 @kbd{M-S} toggles the @option{-S} (@option{--softwrap}) command-line option.
    838 
    839 @item Expert
    840 @kbd{M-X} toggles the @option{-x} (@option{--nohelp}) command-line option.
    841 
    842 @item Syntax Coloring
    843 @kbd{M-Y} toggles syntax coloring, when your nanorc defines syntaxes
    844 (@pxref{Syntax Highlighting}).
    845 
    846 @item Hidden Interface
    847 @kbd{M-Z} toggles the @option{-0} (@option{--zero}) command-line option,
    848 but without the @option{-x} (@option{--nohelp}) part.  That is: it toggles
    849 just the title bar plus status bar (or the combined mini bar plus status bar),
    850 not the help lines.  The latter are toggled with @kbd{M-X}.
    851 
    852 @end table
    853 
    854 
    855 @node Nanorc Files
    856 @chapter Nanorc Files
    857 
    858 Nanorc files can be used to configure @command{nano} to your liking
    859 without using command-line options.  During startup @command{nano}
    860 normally reads two files: first the system-wide file, @file{/etc/nanorc}
    861 (the exact path may be different on your system), and then the user-specific
    862 file, either @file{~/.nanorc} or @file{$XDG_CONFIG_HOME/nano/nanorc} or
    863 @file{.config/nano/nanorc}, whichever exists first.
    864 However, if @option{--rcfile} is given, @command{nano} skips the
    865 above files and reads just the specified settings file.
    866 
    867 A nanorc file can contain @command{set} and @command{unset} commands for
    868 various options (@pxref{Settings}).  It can also contain commands that
    869 define syntax highlighting (@pxref{Syntax Highlighting}) and commands
    870 that rebind keys (@ref{Rebinding Keys}).  Each command should be on a
    871 separate line, and all commands should be written in lowercase.
    872 
    873 Options that do not take an argument are unset by default.  So using
    874 the @code{unset} command is only needed when wanting to override a
    875 setting from the system's nanorc file in your own nanorc.  Options that
    876 take an argument cannot be unset, but can be assigned the empty string.
    877 
    878 Any command-line option overrides its nanorc setting, of course.
    879 
    880 Quotes inside the @var{characters} parameters below should not be escaped.
    881 The last double quote on the line will be seen as the closing quote.
    882 
    883 @menu
    884 * Settings::
    885 * Syntax Highlighting::
    886 * Rebinding Keys::
    887 @end menu
    888 
    889 @node Settings
    890 @section Settings
    891 
    892 The supported settings in a nanorc file are:
    893 
    894 @table @code
    895 
    896 @item set afterends
    897 Make @kbd{Ctrl+Right} and @kbd{Ctrl+Delete} stop at word ends
    898 instead of beginnings.
    899 
    900 @item set allow_insecure_backup
    901 When backing up files, allow the backup to succeed even if its
    902 permissions can't be (re)set due to special OS considerations.
    903 You should NOT enable this option unless you are sure you need it.
    904 
    905 @item set atblanks
    906 When soft line wrapping is enabled, make it wrap lines at blank characters
    907 (tabs and spaces) instead of always at the edge of the screen.
    908 
    909 @item set autoindent
    910 Automatically indent a newly created line to the same number of tabs
    911 and/or spaces as the previous line (or as the next line if the previous
    912 line is the beginning of a paragraph).
    913 
    914 @item set backup
    915 When saving a file, back up the previous version of it, using the current
    916 filename suffixed with a tilde (@code{~}).
    917 
    918 @item set backupdir "@var{directory}"
    919 Make and keep not just one backup file, but make and keep a uniquely
    920 numbered one every time a file is saved --- when backups are enabled
    921 with @code{set backup} or @option{--backup} or @option{-B}.
    922 The uniquely numbered files are stored in the specified directory.
    923 
    924 @item set boldtext
    925 Use bold instead of reverse video for the title bar, status bar,
    926 prompt bar, mini bar, key combos, line numbers, and selected text.
    927 This can be overridden by setting the options @code{titlecolor},
    928 @code{statuscolor}, @code{promptcolor}, @code{minicolor},
    929 @code{keycolor}, @code{numbercolor}, and/or @code{selectedcolor}.
    930 
    931 @item set bookstyle
    932 When justifying, treat any line that starts with whitespace as the
    933 beginning of a paragraph (unless auto-indenting is on).
    934 
    935 @item set brackets "@var{characters}"
    936 Set the characters treated as closing brackets when justifying
    937 paragraphs.  This may not include blank characters.  Only closing
    938 punctuation (see @code{set punct}), optionally followed by the specified
    939 closing brackets, can end sentences.  The default value is
    940 "@t{"')>]@}}".
    941 
    942 @item set breaklonglines
    943 Automatically hard-wrap the current line when it becomes overlong.
    944 
    945 @item set casesensitive
    946 Do case-sensitive searches by default.
    947 
    948 @item set colonparsing
    949 When a filename given on the command line ends in a colon plus digits
    950 and this filename does not exist, then snip the colon plus digits and
    951 understand the digits as a line number.  If the trimmed filename does
    952 not exist either, then repeat the process and understand the obtained
    953 two numbers as line and column number.  But if the doubly trimmed
    954 filename does not exist either, then forget the trimming and accept
    955 the original filename as is.  To disable this colon parsing for some
    956 file, use @code{+1} or similar before the relevant filename.
    957 
    958 @item set constantshow
    959 Constantly report the cursor position on the status bar.
    960 Note that this overrides @option{quickblank}.
    961 
    962 @item set cutfromcursor
    963 Use cut-from-cursor-to-end-of-line by default, instead of cutting the whole line.
    964 
    965 @item set emptyline
    966 Do not use the line below the title bar, leaving it entirely blank.
    967 
    968 @item set errorcolor [bold,][italic,]@var{fgcolor},@var{bgcolor}
    969 Use this color combination for the status bar when an error message is displayed.
    970 The default value is @t{bold,white,red}.
    971 @xref{@code{set keycolor}} for valid color names.
    972 
    973 @item set fill @var{number}
    974 Set the target width for justifying and automatic hard-wrapping at this
    975 @var{number} of columns.  If the value is 0 or less, wrapping occurs
    976 at the width of the screen minus @var{number} columns, allowing the wrap
    977 point to vary along with the width of the screen if the screen is resized.
    978 The default value is @t{-8}.
    979 
    980 @item set functioncolor [bold,][italic,]@var{fgcolor},@var{bgcolor}
    981 Use this color combination for the concise function descriptions
    982 in the two help lines at the bottom of the screen.
    983 @xref{@code{set keycolor}} for valid color names.
    984 
    985 @item set guidestripe @var{number}
    986 Draw a vertical stripe at the given column, to help judge the width of the
    987 text.  (The color of the stripe can be changed with @code{set stripecolor}.)
    988 
    989 @item set historylog
    990 Save the last hundred search strings and replacement strings and
    991 executed commands, so they can be easily reused in later sessions.
    992 
    993 @item set indicator
    994 Display a "scrollbar" on the righthand side of the edit window.
    995 It shows the position of the viewport in the buffer
    996 and how much of the buffer is covered by the viewport.
    997 
    998 @item set jumpyscrolling
    999 Scroll the buffer contents per half-screen instead of per line.
   1000 
   1001 @anchor{@code{set keycolor}}
   1002 @item set keycolor [bold,][italic,]@var{fgcolor},@var{bgcolor}
   1003 Use this color combination for the shortcut key combos
   1004 in the two help lines at the bottom of the screen.
   1005 Valid names for the foreground and background colors are:
   1006 @code{red}, @code{green}, @code{blue},
   1007 @code{magenta}, @code{yellow}, @code{cyan},
   1008 @code{white}, and @code{black}.
   1009 Each of these eight names may be prefixed with the word
   1010 @code{light} to get a brighter version of that color.
   1011 The word @code{grey} or @code{gray} may be used
   1012 as a synonym for @code{lightblack}.
   1013 On a Linux console, @code{light} does not have
   1014 any effect for a background color.
   1015 
   1016 On terminal emulators that can do at least 256 colors,
   1017 other valid (but unprefixable) color names are:
   1018 @code{pink}, @code{purple}, @code{mauve},
   1019 @code{lagoon}, @code{mint}, @code{lime},
   1020 @code{peach}, @code{orange}, @code{latte},
   1021 @code{rosy}, @code{beet}, @code{plum}, @code{sea},
   1022 @code{sky}, @code{slate}, @code{teal}, @code{sage},
   1023 @code{brown}, @code{ocher}, @code{sand}, @code{tawny},
   1024 @code{brick}, @code{crimson}, and @code{normal}
   1025 --- where @code{normal} means the default foreground or background color.
   1026 On such emulators, the color may also be specified as a three-digit hexadecimal
   1027 number prefixed with @code{#}, with the digits representing the amounts of red,
   1028 green, and blue, respectively.  This tells @command{nano} to select from the
   1029 available palette the color that approximates the given values.
   1030 
   1031 Either @var{fgcolor} or ,@var{bgcolor} may be left out,
   1032 and the pair may be preceded by @code{bold} and/or @code{italic}
   1033 (separated by commas) to get a bold and/or slanting typeface,
   1034 if your terminal can do those.
   1035 
   1036 @item set linenumbers
   1037 Display line numbers to the left of the text area.
   1038 (Any line with an anchor additionally gets a mark in the margin.)
   1039 
   1040 @item set locking
   1041 Enable vim-style lock-files for when editing files.
   1042 
   1043 @item set magic
   1044 When neither the file's name nor its first line give a clue,
   1045 try using libmagic to determine the applicable syntax.
   1046 (Calling libmagic can be relatively time consuming.
   1047 It is therefore not done by default.)
   1048 
   1049 @anchor{@code{set matchbrackets}}
   1050 @item set matchbrackets "@var{characters}"
   1051 Specify the opening and closing brackets that can be found by bracket
   1052 searches.  This may not include blank characters.  The opening set must
   1053 come before the closing set, and the two sets must be in the same order.
   1054 The default value is "@t{(<[@{)>]@}}".
   1055 
   1056 @item set minibar
   1057 Suppress the title bar and instead show information about
   1058 the current buffer at the bottom of the screen, in the space
   1059 for the status bar.  In this "mini bar" the filename is shown
   1060 on the left, followed by an asterisk if the buffer has been modified.
   1061 On the right are displayed the current line and column number, the
   1062 code of the character under the cursor (in Unicode format: U+xxxx),
   1063 the same flags as are shown by @code{set stateflags}, and a percentage
   1064 that expresses how far the cursor is into the file (linewise).
   1065 When a file is loaded or saved, and also when switching between buffers,
   1066 the number of lines in the buffer is displayed after the filename.
   1067 This number is cleared upon the next keystroke, or replaced with an
   1068 [i/n] counter when multiple buffers are open.
   1069 The line plus column numbers and the character code are displayed only when
   1070 @code{set constantshow} is used, and can be toggled on and off with @kbd{M-C}.
   1071 The state flags are displayed only when @code{set stateflags} is used.
   1072 
   1073 @item set minicolor [bold,][italic,]@var{fgcolor},@var{bgcolor}
   1074 Use this color combination for the mini bar.
   1075 (When this option is not specified, the colors of the title bar are used.)
   1076 @xref{@code{set keycolor}} for valid color names.
   1077 
   1078 @item set mouse
   1079 Enable mouse support, so that mouse clicks can be used to place the
   1080 cursor, set the mark (with two clicks), or execute shortcuts.
   1081 
   1082 @item set multibuffer
   1083 When reading in a file with @kbd{^R}, insert it into a new buffer by default.
   1084 
   1085 @item set noconvert
   1086 Don't convert files from DOS/Mac format.
   1087 
   1088 @item set nohelp
   1089 Don't display the help lists at the bottom of the screen.
   1090 
   1091 @item set nonewlines
   1092 Don't automatically add a newline when a text does not end with one.
   1093 (This can cause you to save non-POSIX text files.)
   1094 
   1095 @item set nowrap
   1096 Deprecated option since it has become the default setting.
   1097 When needed, use @code{unset breaklonglines} instead.
   1098 
   1099 @item set numbercolor [bold,][italic,]@var{fgcolor},@var{bgcolor}
   1100 Use this color combination for line numbers.
   1101 @xref{@code{set keycolor}} for valid color names.
   1102 
   1103 @item set operatingdir "@var{directory}"
   1104 At startup, make @command{nano} change to the given @var{directory}, and
   1105 allow reading and writing files only in this directory and its subdirectories.
   1106 
   1107 @item set positionlog
   1108 Save the positions of cursor and anchors between editing sessions.
   1109 These positions are remembered for the 200 most-recently edited files.
   1110 
   1111 @item set preserve
   1112 Preserve the XOFF and XON sequences (@kbd{^S} and @kbd{^Q}) so that
   1113 they are caught by the terminal (stopping and resuming the output).
   1114 
   1115 @item set promptcolor [bold,][italic,]@var{fgcolor},@var{bgcolor}
   1116 Use this color combination for the prompt bar.
   1117 (When this option is not specified, the colors of the title bar are used.)
   1118 @xref{@code{set keycolor}} for valid color names.
   1119 
   1120 @item set punct "@var{characters}"
   1121 Set the characters treated as closing punctuation when justifying
   1122 paragraphs.  This may not include blank characters.  Only the
   1123 specified closing punctuation, optionally followed by closing brackets
   1124 (see @code{set brackets}), can end sentences.
   1125 The default value is "@t{!.?}".
   1126 
   1127 @item set quickblank
   1128 Make status-bar messages disappear after 1 keystroke instead of after 20.
   1129 Note that option @option{constantshow} overrides this.
   1130 When option @option{minibar} or @option{zero} is in effect,
   1131 @option{quickblank} makes a message disappear after
   1132 0.8 seconds instead of after the default 1.5 seconds.
   1133 
   1134 @item set quotestr "@var{regex}"
   1135 Set the regular expression for matching the quoting part of a line.
   1136 The default value is "@t{^([@w{ }\t]*([!#%:;>|@}]|//))+}".
   1137 (Note that @code{\t} stands for a literal Tab character.)
   1138 This makes it possible to rejustify blocks of quoted text when composing
   1139 email, and to rewrap blocks of line comments when writing source code.
   1140 
   1141 @item set rawsequences
   1142 Interpret escape sequences directly, instead of asking @code{ncurses}
   1143 to translate them.  (If you need this option to get some keys to work
   1144 properly, it means that the terminfo terminal description that is used
   1145 does not fully match the actual behavior of your terminal.  This can
   1146 happen when you ssh into a BSD machine, for example.)
   1147 Using this option disables @command{nano}'s mouse support.
   1148 
   1149 @item set rebinddelete
   1150 Interpret the @kbd{Delete} and @kbd{Backspace} keys differently so that
   1151 both work properly.  You should only use this option when on your system
   1152 either @kbd{Backspace} acts like Delete or @kbd{Delete} acts like Backspace.
   1153 
   1154 @item set regexp
   1155 Do regular-expression searches by default.
   1156 Regular expressions in @command{nano} are of the extended type (ERE).
   1157 
   1158 @item set saveonexit
   1159 Save a changed buffer automatically on exit (@kbd{^X}); don't prompt.
   1160 
   1161 @item set scrollercolor @var{fgcolor},@var{bgcolor}
   1162 Use this color combination for the indicator alias "scrollbar".
   1163 @xref{@code{set keycolor}} for valid color names.
   1164 
   1165 @item set selectedcolor [bold,][italic,]@var{fgcolor},@var{bgcolor}
   1166 Use this color combination for selected text.
   1167 @xref{@code{set keycolor}} for valid color names.
   1168 
   1169 @item set showcursor
   1170 Put the cursor on the highlighted item in the file browser, and show
   1171 the cursor in the help viewer, to aid braille users and people with
   1172 poor vision.
   1173 
   1174 @item set smarthome
   1175 Make the Home key smarter.  When Home is pressed anywhere but at the
   1176 very beginning of non-whitespace characters on a line, the cursor jumps
   1177 to that beginning (either forwards or backwards).  If the cursor is
   1178 already at that position, it jumps to the true beginning of the line.
   1179 
   1180 @item set softwrap
   1181 Display lines that exceed the screen's width over multiple screen lines.
   1182 (You can make this soft-wrapping occur at whitespace instead of rudely at
   1183 the screen's edge, by using also @code{set atblanks}.)
   1184 
   1185 @item set speller "@var{program} [@var{argument} @dots{}]"
   1186 Use the given program to do spell checking and correcting.
   1187 @xref{@option{--speller}} for details.
   1188 
   1189 @item set spotlightcolor [bold,][italic,]@var{fgcolor},@var{bgcolor}
   1190 Use this color combination for highlighting a search match.
   1191 The default value is @t{black,lightyellow}.
   1192 @xref{@code{set keycolor}} for valid color names.
   1193 
   1194 @item set stateflags
   1195 Use the top-right corner of the screen for showing some state flags:
   1196 @code{I} when auto-indenting, @code{M} when the mark is on, @code{L} when
   1197 hard-wrapping (breaking long lines), @code{R} when recording a macro,
   1198 and @code{S} when soft-wrapping.
   1199 When the buffer is modified, a star (@code{*}) is shown after the
   1200 filename in the center of the title bar.
   1201 
   1202 @item set statuscolor [bold,][italic,]@var{fgcolor},@var{bgcolor}
   1203 Use this color combination for the status bar.
   1204 @xref{@code{set keycolor}} for valid color names.
   1205 
   1206 @item set stripecolor [bold,][italic,]@var{fgcolor},@var{bgcolor}
   1207 Use this color combination for the vertical guiding stripe.
   1208 @xref{@code{set keycolor}} for valid color names.
   1209 
   1210 @item set tabsize @var{number}
   1211 Use a tab size of @var{number} columns.  The value of @var{number} must be
   1212 greater than 0.  The default value is @t{8}.
   1213 
   1214 @item set tabstospaces
   1215 Convert each typed tab to spaces --- to the number of spaces
   1216 that a tab at that position would take up.
   1217 (Note: pasted tabs are not converted.)
   1218 
   1219 @item set titlecolor [bold,][italic,]@var{fgcolor},@var{bgcolor}
   1220 Use this color combination for the title bar.
   1221 @xref{@code{set keycolor}} for valid color names.
   1222 
   1223 @item set trimblanks
   1224 Remove trailing whitespace from wrapped lines when automatic
   1225 hard-wrapping occurs or when text is justified.
   1226 
   1227 @item set unix
   1228 Save a file by default in Unix format.  This overrides nano's
   1229 default behavior of saving a file in the format that it had.
   1230 (This option has no effect when you also use @code{set noconvert}.)
   1231 
   1232 @anchor{Whitespace}
   1233 @item set whitespace "@var{characters}"
   1234 Set the two characters used to indicate the presence of tabs and
   1235 spaces.  They must be single-column characters.  The default pair
   1236 for a UTF-8 locale is @t{"»·"}, and for other locales @t{">."}.
   1237 
   1238 @item set wordbounds
   1239 Detect word boundaries differently by treating punctuation
   1240 characters as part of a word.
   1241 
   1242 @item set wordchars "@var{characters}"
   1243 Specify which other characters (besides the normal alphanumeric ones)
   1244 should be considered as parts of words.  When using this option, you
   1245 probably want to unset @code{wordbounds}.
   1246 
   1247 @item set zap
   1248 Let an unmodified @kbd{Backspace} or @kbd{Delete} erase the marked region
   1249 (instead of a single character, and without affecting the cutbuffer).
   1250 
   1251 @item set zero
   1252 Hide all elements of the interface (title bar, status bar, and help lines)
   1253 and use all rows of the terminal for showing the contents of the buffer.
   1254 The status bar appears only when there is a significant message,
   1255 and disappears after 1.5 seconds or upon the next keystroke.
   1256 With @kbd{M-Z} the title bar plus status bar can be toggled.
   1257 With @kbd{M-X} the help lines.
   1258 
   1259 @end table
   1260 
   1261 @node Syntax Highlighting
   1262 @section Syntax Highlighting
   1263 
   1264 Coloring the different syntactic elements of a file
   1265 is done via regular expressions (see the @code{color} command below).
   1266 This is inherently imperfect, because regular expressions are not
   1267 powerful enough to fully parse a file.  Nevertheless, regular
   1268 expressions can do a lot and are easy to make, so they are a
   1269 good fit for a small editor like @command{nano}.
   1270 
   1271 See @file{/usr/share/nano/} and @file{/usr/share/nano/extra/}
   1272 for the syntax-coloring definitions that are available out of the box.
   1273 
   1274 All regular expressions in @command{nano} are POSIX extended regular expressions
   1275 (ERE).  This means that @code{.}, @code{?}, @code{*}, @code{+}, @code{^},
   1276 @code{$}, and several other characters are special.
   1277 The period @code{.} matches any single character,
   1278 @code{?} means the preceding item is optional,
   1279 @code{*} means the preceding item may be matched zero or more times,
   1280 @code{+} means the preceding item must be matched one or more times,
   1281 @code{^} matches the beginning of a line, and @code{$} the end,
   1282 @code{\<} matches the start of a word, and @code{\>} the end,
   1283 and @code{\s} matches a blank.
   1284 It also means that lookahead and lookbehind are not possible.
   1285 A complete explanation can be found in the manual of GNU grep:
   1286 @code{info grep regular}.
   1287 
   1288 Each regular expression in a @file{nanorc} file should be wrapped in
   1289 double quotes (@code{""}).  Multiple regular expressions can follow
   1290 each other on a line by separating them with blanks.  This means that
   1291 a regular expression cannot contain a double quote followed by a blank.
   1292 When you need this combination inside a regular expression,
   1293 then either the double quote or the blank should be put
   1294 between square brackets (@code{[]}).
   1295 
   1296 A separate syntax can be defined for each kind of file
   1297 via the following commands in a nanorc file:
   1298 
   1299 @table @code
   1300 
   1301 @item syntax @var{name} ["@var{fileregex}" @dots{}]
   1302 Start the definition of a syntax with this @var{name}.
   1303 All subsequent @code{color} and other such commands
   1304 are added to this syntax, until a new @code{syntax}
   1305 command is encountered.
   1306 
   1307 When @command{nano} is run, this syntax is automatically
   1308 activated (for the relevant buffer) if the absolute filename
   1309 matches the extended regular expression @var{fileregex}.
   1310 Or the syntax can be explicitly activated (for all buffers)
   1311 by using the @option{-Y} or @option{--syntax}
   1312 command-line option followed by the @var{name}.
   1313 
   1314 The @code{default} syntax is special: it takes no @var{fileregex},
   1315 and applies to files that don't match any syntax's regexes.
   1316 The @code{none} syntax is reserved; specifying it on the
   1317 command line is the same as not having a syntax at all.
   1318 
   1319 @item header "@var{regex}" @dots{}
   1320 If from all defined syntaxes no @var{fileregex} matched, then compare
   1321 this @var{regex} (or regexes) against the first line of the current file,
   1322 to determine whether this syntax should be used for it.
   1323 
   1324 @item magic "@var{regex}" @dots{}
   1325 If no @var{fileregex} matched and no @code{header} regex matched
   1326 either, then compare this @var{regex} (or regexes) against the
   1327 result of querying the @code{magic} database about the current
   1328 file, to determine whether this syntax should be used for it.
   1329 (This querying is done only when @code{libmagic} is actually installed
   1330 on the system and @option{--magic} or @code{set magic} was given.)
   1331 
   1332 @item formatter @var{program} [@var{argument} @dots{}]
   1333 Run the given @var{program} on the full contents of the current buffer.
   1334 
   1335 @item linter @var{program} [@var{argument} @dots{}]
   1336 Use the given @var{program} to do a syntax check on the current buffer.
   1337 
   1338 @item comment "@var{string}"
   1339 Use the given string for commenting and uncommenting lines.
   1340 If the string contains a vertical bar or pipe character (@t{|}),
   1341 this designates bracket-style comments; for example, @t{"/*|*/"} for
   1342 CSS files.  The characters before the pipe are prepended to the line and the
   1343 characters after the pipe are appended at the end of the line.  If no pipe
   1344 character is present, the full string is prepended; for example, @t{"#"} for
   1345 Python files.  If empty double quotes are specified, the comment/uncomment
   1346 functions are disabled; for example, @t{""} for JSON.
   1347 The default value is "@t{#}".
   1348 
   1349 @item tabgives "@var{string}"
   1350 Make the <Tab> key produce the given @var{string}.  Useful for languages like
   1351 Python that want to see only spaces for indentation.
   1352 This overrides the setting of the @code{tabstospaces} option.
   1353 
   1354 @item color [bold,][italic,]@var{fgcolor},@var{bgcolor} "@var{regex}" @dots{}
   1355 Paint all pieces of text that match the extended regular expression "regex"
   1356 with the given foreground and background colors, at least one of which must
   1357 be specified.  Valid color names are:
   1358 @code{red}, @code{green}, @code{blue},
   1359 @code{magenta}, @code{yellow}, @code{cyan},
   1360 @code{white}, and @code{black}.
   1361 Each of these eight names may be prefixed with the word
   1362 @code{light} to get a brighter version of that color.
   1363 The word @code{grey} or @code{gray} may be used
   1364 as a synonym for @code{lightblack}.
   1365 On a Linux console, @code{light} does not have
   1366 any effect for a background color.
   1367 
   1368 On terminal emulators that can do at least 256 colors,
   1369 other valid (but unprefixable) color names are:
   1370 @code{pink}, @code{purple}, @code{mauve},
   1371 @code{lagoon}, @code{mint}, @code{lime},
   1372 @code{peach}, @code{orange}, @code{latte},
   1373 @code{rosy}, @code{beet}, @code{plum}, @code{sea},
   1374 @code{sky}, @code{slate}, @code{teal}, @code{sage},
   1375 @code{brown}, @code{ocher}, @code{sand}, @code{tawny},
   1376 @code{brick}, @code{crimson}, and @code{normal}
   1377 --- where @code{normal} means the default foreground or background color.
   1378 On such emulators, the color may also be specified as a three-digit hexadecimal
   1379 number prefixed with @code{#}, with the digits representing the amounts of red,
   1380 green, and blue, respectively.  This tells @command{nano} to select from the
   1381 available palette the color that approximates the given values.
   1382 
   1383 The color pair may be preceded by @code{bold} and/or @code{italic}
   1384 (separated by commas) to get a bold and/or slanting typeface,
   1385 if your terminal can do those.
   1386 
   1387 All coloring commands are applied in the order in which they are specified,
   1388 which means that later commands can recolor stuff that was colored earlier.
   1389 
   1390 @item icolor [bold,][italic,]@var{fgcolor},@var{bgcolor} "@var{regex}" @dots{}
   1391 Same as above, except that the matching is case insensitive.
   1392 
   1393 @item color [bold,][italic,]@var{fgcolor},@var{bgcolor} start="@var{fromrx}" end="@var{torx}"
   1394 Paint all pieces of text whose start matches extended regular expression
   1395 @var{fromrx} and whose end matches extended regular expression @var{torx}
   1396 with the given foreground and background colors, at least one of
   1397 which must be specified.  This means that, after an initial instance of
   1398 @var{fromrx}, all text until the first instance of @var{torx} is colored.
   1399 This allows syntax highlighting to span multiple lines.
   1400 
   1401 @item icolor [bold,][italic,]@var{fgcolor},@var{bgcolor} start="@var{fromrx}" end="@var{torx}"
   1402 Same as above, except that the matching is case insensitive.
   1403 
   1404 @item include "@var{syntaxfile}"
   1405 Read in self-contained color syntaxes from @var{syntaxfile}.  Note that
   1406 such a syntax file may contain only the above commands, from @code{syntax}
   1407 to @code{icolor}.
   1408 
   1409 @item extendsyntax @var{name} @var{command} @var{argument} @dots{}
   1410 Extend the syntax previously defined as "@var{name}" with another @var{command}.
   1411 This allows you to add a new @code{color}, @code{icolor}, @code{header},
   1412 @code{magic}, @code{formatter}, @code{linter}, @code{comment},
   1413 or @code{tabgives} command to an already
   1414 defined syntax --- useful when you want to slightly improve a syntax defined
   1415 in one of the system-installed files (which normally are not writable).
   1416 
   1417 @end table
   1418 
   1419 @node Rebinding Keys
   1420 @section Rebinding Keys
   1421 
   1422 Key bindings can be changed via the following three commands in a
   1423 nanorc file:
   1424 
   1425 @table @code
   1426 
   1427 @item bind key function menu
   1428 Rebinds @code{key} to @code{function} in the context of @code{menu}
   1429 (or in all menus where the function exists when @code{all} is used).
   1430 
   1431 @item bind key "string" menu
   1432 Makes @code{key} produce @code{string} in the context of @code{menu}
   1433 (or in all menus where the key exists when @code{all} is used).
   1434 Besides literal text and/or control codes, the  @code{string} may contain
   1435 function names between braces.  These functions are invoked when the
   1436 key is typed. To include a literal opening brace, use @code{@{@{@}}.
   1437 
   1438 @item unbind key menu
   1439 Unbinds @code{key} from @code{menu}
   1440 (or from all menus where the key exists when @code{all} is used).
   1441 
   1442 @end table
   1443 
   1444 Note that @code{bind key "@{function@}" menu} is equivalent to
   1445 @code{bind key function menu}, except that for the latter form
   1446 @command{nano} checks the availability of the @code{function}
   1447 in the given @code{menu} at startup time (and reports an error if
   1448 it does not exist there), whereas for the first form @command{nano}
   1449 checks at execution time that the @code{function} exists but not
   1450 whether it makes any sense in the current menu. The user has to take
   1451 care that a function name between braces (or any sequence of them)
   1452 is appropriate.  Strange behavior or even a crash can result when
   1453 the braced name is unfitting.
   1454 
   1455 @sp 1
   1456 The format of @code{key} should be one of:
   1457 
   1458 @indentedblock
   1459 @table @asis
   1460 
   1461 @item @code{^@var{X}}
   1462 where @var{X} is a Latin letter, or one of several
   1463 ASCII characters (@@, ], \, ^, _), or the word "Space".
   1464 Example: @code{^C}.
   1465 
   1466 @item @code{M-@var{X}}
   1467 where @var{X} is any ASCII character except [, or the word "Space".
   1468 Example: @code{M-8}.
   1469 
   1470 @item @code{Sh-M-@var{X}}
   1471 where @var{X} is a Latin letter.
   1472 Example: @code{Sh-M-U}.
   1473 By default, each Meta+letter keystroke does the same as the corresponding
   1474 Shift+Meta+letter.  But when any Shift+Meta bind is made, that will
   1475 no longer be the case, for all letters.
   1476 
   1477 @item @code{F@var{n}}
   1478 where @var{n} is a numeric value from 1 to 24.
   1479 Example: @code{F10}.
   1480 (Often, @code{F13} to @code{F24} can be typed as @code{F1} to @code{F12}
   1481 with Shift.)
   1482 
   1483 @item @code{Ins} or @code{Del}
   1484 
   1485 @end table
   1486 @end indentedblock
   1487 
   1488 @sp 1
   1489 Rebinding @code{^M} (Enter) or @code{^I} (Tab) is probably not a good idea.
   1490 Rebinding @code{^[} (Esc) is not possible, because its keycode
   1491 is the starter byte of Meta keystrokes and escape sequences.
   1492 Rebinding any of the dedicated cursor-moving keys (the arrows, Home, End,
   1493 PageUp and PageDown) is not possible.
   1494 On some terminals it's not possible to rebind @code{^H} (unless @code{--raw}
   1495 is used) because its keycode is identical to that of the Backspace key.
   1496 
   1497 @sp 1
   1498 Valid names for the @code{function} to be bound are:
   1499 
   1500 @table @code
   1501 
   1502 @item help
   1503 Invokes the help viewer.
   1504 
   1505 @item cancel
   1506 Cancels the current command.
   1507 
   1508 @item exit
   1509 Exits from the program (or from the help viewer or file browser).
   1510 
   1511 @item writeout
   1512 Writes the current buffer to disk, asking for a name.
   1513 
   1514 @item savefile
   1515 Writes the current file to disk without prompting.
   1516 
   1517 @item insert
   1518 Inserts a file into the current buffer (at the current cursor position),
   1519 or into a new buffer when option @code{multibuffer} is set.
   1520 
   1521 @item whereis
   1522 Starts a forward search for text in the current buffer --- or for filenames
   1523 matching a string in the current list in the file browser.
   1524 
   1525 @item wherewas
   1526 Starts a backward search for text in the current buffer --- or for filenames
   1527 matching a string in the current list in the file browser.
   1528 
   1529 @item findprevious
   1530 Searches the next occurrence in the backward direction.
   1531 
   1532 @item findnext
   1533 Searches the next occurrence in the forward direction.
   1534 
   1535 @item replace
   1536 Interactively replaces text within the current buffer.
   1537 
   1538 @item cut
   1539 Cuts and stores the current line (or the marked region).
   1540 
   1541 @item copy
   1542 Copies the current line (or the marked region) without deleting it.
   1543 
   1544 @item paste
   1545 Pastes the currently stored text into the current buffer at the
   1546 current cursor position.
   1547 
   1548 @item zap
   1549 Throws away the current line (or the marked region).
   1550 (This function is bound by default to @kbd{Alt+Delete}.)
   1551 
   1552 @item chopwordleft
   1553 Deletes from the cursor position to the beginning of the preceding word.
   1554 (This function is bound by default to @kbd{Shift+Ctrl+Delete}.  If your terminal
   1555 produces @code{^H} for @kbd{Ctrl+Backspace}, you can make @kbd{Ctrl+Backspace} delete
   1556 the word to the left of the cursor by rebinding @kbd{^H} to this function.)
   1557 
   1558 @item chopwordright
   1559 Deletes from the cursor position to the beginning of the next word.
   1560 (This function is bound by default to @kbd{Ctrl+Delete}.)
   1561 
   1562 @item cutrestoffile
   1563 Cuts all text from the cursor position till the end of the buffer.
   1564 
   1565 @item mark
   1566 Sets the mark at the current position, to start selecting text.
   1567 Or, when it is set, unsets the mark.
   1568 
   1569 @item location
   1570 Reports the current position of the cursor in the buffer:
   1571 the line, column, and character positions.
   1572 
   1573 @item wordcount
   1574 Counts and reports on the status bar the number of lines, words,
   1575 and characters in the current buffer (or in the marked region).
   1576 
   1577 @item execute
   1578 Prompts for a program to execute.  The program's output will be inserted
   1579 into the current buffer (or into a new buffer when @kbd{M-F} is toggled).
   1580 
   1581 @item speller
   1582 Invokes a spell-checking program, either the default @command{hunspell}
   1583 or GNU @command{spell}, or the one defined by @option{--speller} or
   1584 @code{set speller}.
   1585 
   1586 @item formatter
   1587 Invokes a full-buffer-processing program (if the active syntax defines one).
   1588 (The current buffer is written out to a temporary file, the program
   1589 is run on it, and then the temporary file is read back in, replacing
   1590 the contents of the buffer.)
   1591 
   1592 @item linter
   1593 Invokes a syntax-checking program (if the active syntax defines one).
   1594 If this program produces lines of the form "filename:linenum:charnum:
   1595 some message", then the cursor is put at the indicated position
   1596 in the mentioned file while showing "some message" on the status bar.
   1597 You can move from message to message with @kbd{PgUp} and @kbd{PgDn},
   1598 and leave linting mode with @kbd{^C} or @kbd{Enter}.
   1599 
   1600 @item justify
   1601 Justifies the current paragraph (or the marked region).
   1602 A paragraph is a group of contiguous lines that, apart from possibly
   1603 the first line, all have the same indentation.  The beginning of a
   1604 paragraph is detected by either this lone line with a differing
   1605 indentation or by a preceding blank line.
   1606 
   1607 @item fulljustify
   1608 Justifies the entire current buffer (or the marked region).
   1609 
   1610 @item indent
   1611 Indents (shifts to the right) the current line or the marked lines.
   1612 
   1613 @item unindent
   1614 Unindents (shifts to the left) the current line or the marked lines.
   1615 
   1616 @item comment
   1617 Comments or uncomments the current line or the marked lines,
   1618 using the comment style specified in the active syntax.
   1619 
   1620 @item complete
   1621 Completes (when possible) the fragment before the cursor
   1622 to a full word found elsewhere in the current buffer.
   1623 
   1624 @item left
   1625 Goes left one position (in the editor or browser).
   1626 
   1627 @item right
   1628 Goes right one position (in the editor or browser).
   1629 
   1630 @item up
   1631 Goes one line up (in the editor or browser).
   1632 
   1633 @item down
   1634 Goes one line down (in the editor or browser).
   1635 
   1636 @item scrollup
   1637 Scrolls the viewport up one row (meaning that the text slides down)
   1638 while keeping the cursor in the same text position, if possible.
   1639 (This function is bound by default to @kbd{Alt+Up}.
   1640 If @kbd{Alt+Up} does nothing on your Linux console, see the FAQ:
   1641 @url{https://nano-editor.org/dist/latest/faq.html#4.1}.)
   1642 
   1643 @item scrolldown
   1644 Scrolls the viewport down one row (meaning that the text slides up)
   1645 while keeping the cursor in the same text position, if possible.
   1646 (This function is bound by default to @kbd{Alt+Down}.)
   1647 
   1648 @item center
   1649 Scrolls the line with the cursor to the middle of the viewport.
   1650 
   1651 @item cycle
   1652 Scrolls the line with the cursor first to the middle of the viewport,
   1653 then to the top, then to the bottom.
   1654 
   1655 @item prevword
   1656 Moves the cursor to the beginning of the previous word.
   1657 
   1658 @item nextword
   1659 Moves the cursor to the beginning of the next word.
   1660 
   1661 @item home
   1662 Moves the cursor to the beginning of the current line.
   1663 
   1664 @item end
   1665 Moves the cursor to the end of the current line.
   1666 
   1667 @item beginpara
   1668 Moves the cursor to the beginning of the current paragraph.
   1669 
   1670 @item endpara
   1671 Moves the cursor to the end of the current paragraph.
   1672 
   1673 @item prevblock
   1674 Moves the cursor to the beginning of the current or preceding block of text.
   1675 (Blocks are separated by one or more blank lines.)
   1676 
   1677 @item nextblock
   1678 Moves the cursor to the beginning of the next block of text.
   1679 
   1680 @item toprow
   1681 Moves the cursor to the first row in the viewport.
   1682 
   1683 @item bottomrow
   1684 Moves the cursor to the last row in the viewport.
   1685 
   1686 @item pageup
   1687 Goes up one screenful.
   1688 
   1689 @item pagedown
   1690 Goes down one screenful.
   1691 
   1692 @item firstline
   1693 Goes to the first line of the file.
   1694 
   1695 @item lastline
   1696 Goes to the last line of the file.
   1697 
   1698 @item gotoline
   1699 Goes to a specific line (and column if specified).  Negative numbers count
   1700 from the end of the file (and end of the line).
   1701 
   1702 @item findbracket
   1703 Moves the cursor to the bracket (or brace or parenthesis, etc.) that matches
   1704 (pairs) with the one under the cursor.  @xref{@code{set matchbrackets}}.
   1705 
   1706 @item anchor
   1707 Places an anchor at the current line, or removes it when already present.
   1708 (An anchor is visible when line numbers are activated.)
   1709 
   1710 @item prevanchor
   1711 Goes to the first anchor before the current line.
   1712 
   1713 @item nextanchor
   1714 Goes to the first anchor after the current line.
   1715 
   1716 @item prevbuf
   1717 Switches to editing/viewing the previous buffer when multiple buffers are open.
   1718 
   1719 @item nextbuf
   1720 Switches to editing/viewing the next buffer when multiple buffers are open.
   1721 
   1722 @item verbatim
   1723 Inserts the next keystroke verbatim into the file, or begins Unicode input
   1724 when a hexadecimal digit is typed (@pxref{Entering Text} for details).
   1725 
   1726 @item tab
   1727 Inserts a tab at the current cursor location.
   1728 
   1729 @item enter
   1730 Inserts a new line below the current one.
   1731 
   1732 @item delete
   1733 Deletes the character under the cursor.
   1734 
   1735 @item backspace
   1736 Deletes the character before the cursor.
   1737 
   1738 @item recordmacro
   1739 Starts the recording of keystrokes --- the keystrokes are stored
   1740 as a macro.  When already recording, the recording is stopped.
   1741 
   1742 @item runmacro
   1743 Replays the keystrokes of the last recorded macro.
   1744 
   1745 @item undo
   1746 Undoes the last performed text action (add text, delete text, etc).
   1747 
   1748 @item redo
   1749 Redoes the last undone action (i.e., it undoes an undo).
   1750 
   1751 @item refresh
   1752 Refreshes the screen.
   1753 
   1754 @item suspend
   1755 Suspends the editor and returns control to the shell
   1756 (until you tell the process to resume execution with @kbd{fg}).
   1757 
   1758 @item casesens
   1759 Toggles whether searching/replacing ignores or respects the case of
   1760 the given characters.
   1761 
   1762 @item regexp
   1763 Toggles whether searching/replacing uses literal strings or regular expressions.
   1764 
   1765 @item backwards
   1766 Toggles whether searching/replacing goes forward or backward.
   1767 
   1768 @item older
   1769 Retrieves the previous (earlier) entry at a prompt.
   1770 
   1771 @item newer
   1772 Retrieves the next (later) entry at a prompt.
   1773 
   1774 @item flipreplace
   1775 Toggles between searching for something and replacing something.
   1776 
   1777 @item flipgoto
   1778 Toggles between searching for text and targeting a line number.
   1779 
   1780 @item flipexecute
   1781 Switches from inserting a file to executing a command.
   1782 
   1783 @item flippipe
   1784 When executing a command, toggles whether the current buffer (or marked
   1785 region) is piped to the command.
   1786 
   1787 @item flipnewbuffer
   1788 Toggles between inserting into the current buffer and into a new
   1789 empty buffer.
   1790 
   1791 @item flipconvert
   1792 When reading in a file, toggles between converting and not converting
   1793 it from DOS/Mac format.  Converting is the default.
   1794 
   1795 @item dosformat
   1796 When writing a file, switches to writing a DOS format (CR/LF).
   1797 
   1798 @item macformat
   1799 When writing a file, switches to writing a Mac format.
   1800 
   1801 @item append
   1802 When writing a file, appends to the end instead of overwriting.
   1803 
   1804 @item prepend
   1805 When writing a file, 'prepends' (writes at the beginning) instead of overwriting.
   1806 
   1807 @item backup
   1808 When writing a file, creates a backup of the current file.
   1809 
   1810 @item discardbuffer
   1811 When about to write a file, discard the current buffer without saving.
   1812 (This function is bound by default only when option @option{--saveonexit}
   1813 is in effect.)
   1814 
   1815 @item browser
   1816 Starts the file browser (in the Read File and Write Out menus),
   1817 allowing to select a file from a list.
   1818 
   1819 @item gotodir
   1820 Goes to a directory to be specified, allowing to browse anywhere
   1821 in the filesystem.
   1822 
   1823 @item firstfile
   1824 Goes to the first file in the list when using the file browser.
   1825 
   1826 @item lastfile
   1827 Goes to the last file in the list when using the file browser.
   1828 
   1829 @item nohelp
   1830 Toggles the presence of the two-line list of key bindings at the bottom of the screen.
   1831 (This toggle is special: it is available in all menus except the help viewer
   1832 and the linter.  All further toggles are available in the main menu only.)
   1833 
   1834 @item zero
   1835 Toggles the presence of title bar and status bar.
   1836 
   1837 @item constantshow
   1838 Toggles the constant reporting (on the status bar)
   1839 of the current line, column, and character positions.
   1840 
   1841 @item softwrap
   1842 Toggles the displaying of overlong lines on multiple screen lines.
   1843 
   1844 @item linenumbers
   1845 Toggles the display of line numbers in front of the text.
   1846 
   1847 @item whitespacedisplay
   1848 Toggles the showing of whitespace.
   1849 
   1850 @item nosyntax
   1851 Toggles syntax highlighting.
   1852 
   1853 @item smarthome
   1854 Toggles the smartness of the Home key.
   1855 
   1856 @item autoindent
   1857 Toggles whether a newly created line will contain the same amount of leading
   1858 whitespace as the preceding line --- or as the next line if the preceding line
   1859 is the beginning of a paragraph.
   1860 
   1861 @item cutfromcursor
   1862 Toggles whether cutting text cuts the whole line or just from the current cursor
   1863 position to the end of the line.
   1864 
   1865 @item breaklonglines
   1866 Toggles whether the overlong part of a line is hard-wrapped to the next line.
   1867 
   1868 @item tabstospaces
   1869 Toggles whether typed tabs are converted to spaces.
   1870 
   1871 @item mouse
   1872 Toggles mouse support.
   1873 
   1874 @end table
   1875 
   1876 @sp 1
   1877 Valid names for @code{menu} are:
   1878 
   1879 @table @code
   1880 
   1881 @item main
   1882 The main editor window where text is entered and edited.
   1883 
   1884 @item help
   1885 The help-viewer menu.
   1886 
   1887 @item search
   1888 The search menu (AKA whereis).
   1889 
   1890 @item replace
   1891 The 'search to replace' menu.
   1892 
   1893 @item replacewith
   1894 The 'replace with' menu, which comes up after 'search to replace'.
   1895 
   1896 @item yesno
   1897 The 'yesno' menu, where the Yes/No/All/Cancel question is asked.
   1898 
   1899 @item gotoline
   1900 The 'goto line (and column)' menu.
   1901 
   1902 @item writeout
   1903 The 'write file' menu.
   1904 
   1905 @item insert
   1906 The 'insert file' menu.
   1907 
   1908 @item browser
   1909 The 'file browser' menu, for selecting a file to be opened or
   1910 inserted or written to.
   1911 
   1912 @item whereisfile
   1913 The 'search for a file' menu in the file browser.
   1914 
   1915 @item gotodir
   1916 The 'go to directory' menu in the file browser.
   1917 
   1918 @item execute
   1919 The menu for inserting the output from an external command,
   1920 or for filtering the buffer (or the marked region) through
   1921 an external command, or for executing one of several tools.
   1922 
   1923 @item spell
   1924 The menu of the integrated spell checker where the user can edit a misspelled word.
   1925 
   1926 @item linter
   1927 The linter menu, which allows jumping through the linting messages.
   1928 
   1929 @item all
   1930 A special name that encompasses all menus.  For @code{bind} it means
   1931 all menus where the specified @code{function} exists; for @code{unbind}
   1932 it means all menus where the specified @code{key} exists.
   1933 
   1934 @end table
   1935 
   1936 
   1937 @node Pico Compatibility
   1938 @chapter Pico Compatibility
   1939 
   1940 @command{nano} emulates Pico quite closely, but there
   1941 are some differences between the two editors:
   1942 
   1943 @table @code
   1944 
   1945 @item Hard-Wrapping
   1946 Unlike Pico, @command{nano} does not automatically hard-wrap the current
   1947 line when it becomes overlong during typing.  This hard-wrapping can be
   1948 switched on with the @option{--breaklonglines} option.  With that option,
   1949 @command{nano} by default breaks lines at screen width minus eight columns,
   1950 whereas Pico does it at screen width minus six columns. You can make
   1951 @command{nano} do as Pico by using @option{--fill=-6}.
   1952 
   1953 @item Scrolling
   1954 By default, @command{nano} scrolls just one line (instead of half
   1955 a screen) when the cursor is moved to a line that is just out of view.
   1956 And when paging up or down, @command{nano} keeps the cursor in the same
   1957 screen position as much as possible, instead of always placing it on the
   1958 first line of the viewport.  The Pico-like behavior can be obtained
   1959 with the @option{--jumpyscrolling} option.
   1960 
   1961 @item Edit Area
   1962 Pico never uses the line directly below the title bar, leaving it always
   1963 blank.  @command{nano} includes this line in the editing area, in order
   1964 to not waste space, and because in this way it is slightly clearer where
   1965 the text starts.  If you are accustomed to this line being empty, you can
   1966 get it back with the @option{--emptyline} option.
   1967 
   1968 @item Interactive Replace
   1969 Instead of allowing you to replace either just one occurrence of a search
   1970 string or all of them, @command{nano}'s replace function is interactive:
   1971 it pauses at each found search string and asks whether to replace this
   1972 instance.  You can then choose Yes, or No (skip this one), or All (don't
   1973 ask any more), or Cancel (stop with replacing).
   1974 
   1975 @item Search and Replace History
   1976 When the option @option{-H} or @option{--historylog} is given (or set in
   1977 a nanorc file), text entered as search or replace strings is stored.
   1978 These strings can be accessed with the up/down arrow keys at their
   1979 respective prompts, or you can
   1980 type the first few characters and then use @kbd{Tab} to cycle through the
   1981 matching strings.  A retrieved string can subsequently be edited.
   1982 
   1983 @item Position History
   1984 When the option @option{-P} or @option{--positionlog} is given (or set in
   1985 a nanorc file), @command{nano} will store the position of the cursor
   1986 when you close a file, and will place the cursor in that position
   1987 again when you later reopen the file.
   1988 
   1989 @item Current Cursor Position
   1990 The output of the "Display Cursor Position" command (@kbd{^C}) displays
   1991 not only the current line and character position of the cursor,
   1992 but also (between the two) the current column position.
   1993 
   1994 @item Spell Checking
   1995 In the internal spell checker misspelled words are sorted alphabetically
   1996 and trimmed for uniqueness, such that the strings 'Aplpe' and 'aplpe'
   1997 will be offered for correction separately.
   1998 
   1999 @item Writing Selected Text to Files
   2000 When using the Write-Out key (@kbd{^O}), text that has been selected using the
   2001 marking key (@kbd{^^}) can not just be written out to a new (or existing) file,
   2002 it can also be appended or prepended to an existing file.
   2003 
   2004 @item Reading Text from a Command
   2005 When using the Read-File key (@kbd{^R}), @command{nano} can not just read a file,
   2006 it can also read the output of a command to be run (@kbd{^X}).
   2007 
   2008 @item Reading from Working Directory
   2009 By default, Pico reads files from the user's home directory (when
   2010 using @kbd{^R}), but it writes files to the current working directory
   2011 (when using @kbd{^O}).  @command{nano} makes this symmetrical: always reading
   2012 from and writing to the current working directory --- the directory
   2013 that @command{nano} was started in.
   2014 
   2015 @item File Browser
   2016 In the file browser, @command{nano} does not implement the Add, Copy,
   2017 Rename, and Delete commands that Pico provides.  In @command{nano} the
   2018 browser is just a file browser, not a file manager.
   2019 
   2020 @item Toggles
   2021 Many options which alter the functionality of the program can be
   2022 "toggled" on or off using Meta key sequences, meaning the program does
   2023 not have to be restarted to turn a particular feature on or off.
   2024 @xref{Feature Toggles} for a list of options that can be toggled.
   2025 Or see the list at the end of the main internal help text (@kbd{^G}) instead.
   2026 
   2027 @end table
   2028 
   2029 
   2030 @node Building and its Options
   2031 @chapter Building and its Options
   2032 
   2033 Building @command{nano} from source is straightforward if you are
   2034 familiar with compiling programs with autoconf support:
   2035 
   2036 @blankline
   2037 @example
   2038   tar -xf nano-x.y.tar.gz
   2039   cd nano-x.y
   2040   ./configure
   2041   make
   2042   make install
   2043 @end example
   2044 @blankline
   2045 
   2046 The possible options to @code{./configure} are:
   2047 
   2048 @table @code
   2049 
   2050 @item --disable-browser
   2051 Exclude the file browser that can be called with @kbd{^T} when
   2052 wanting to read or write a file.
   2053 
   2054 @item --disable-color
   2055 Exclude support for syntax coloring.  This also eliminates the @option{-Y}
   2056 command-line option, which allows choosing a specific syntax.
   2057 
   2058 @item --disable-comment
   2059 Exclude the single-keystroke comment/uncomment function (@w{@kbd{M-3}}).
   2060 
   2061 @item --disable-extra
   2062 Exclude the Easter egg: a crawl of major contributors.
   2063 
   2064 @item --disable-formatter
   2065 Exclude the code for calling a formatting tool.
   2066 
   2067 @item --disable-help
   2068 Exclude the help texts (@kbd{^G}).  This makes the binary much smaller,
   2069 but also makes it difficult for new users to learn more than very basic
   2070 things about using the editor.
   2071 
   2072 @item --disable-histories
   2073 Exclude the code for handling the history files: the search and
   2074 replace strings that were used, the commands that were executed,
   2075 and the cursor position at which each file was closed.
   2076 This also eliminates the @option{-H} and @option{-P} command-line
   2077 options, which switch on the storing of search/replace strings,
   2078 executed commands, and cursor positions.
   2079 
   2080 @item --disable-justify
   2081 Exclude the text-justification functions (@kbd{^J} and @kbd{M-J}).
   2082 
   2083 @item --disable-libmagic
   2084 Exclude the code for using the library of magic-number tests (for
   2085 determining the file type and thus which syntax to use for coloring ---
   2086 in most cases the regexes for filename and header line will be enough).
   2087 
   2088 @item --disable-linenumbers
   2089 Exclude the ability to show line numbers.  This also eliminates
   2090 the @option{-l} command-line option, which turns line numbering on.
   2091 
   2092 @item --disable-linter
   2093 Exclude the code for calling a linting tool.
   2094 
   2095 @item --disable-mouse
   2096 Exclude all mouse functionality.  This also eliminates the @option{-m}
   2097 command-line option, which enables the mouse functionality.
   2098 
   2099 @item --disable-multibuffer
   2100 Exclude support for opening multiple files at a time and switching
   2101 between them.  This also eliminates the @option{-F} command-line option,
   2102 which causes a file to be read into a separate buffer by default.
   2103 
   2104 @item --disable-nanorc
   2105 Exclude support for reading the nanorc files at startup.  With such
   2106 support, you can store custom settings in a system-wide and a per-user
   2107 nanorc file rather than having to pass command-line options to get
   2108 the desired behavior.  @xref{Nanorc Files} for more info.
   2109 Disabling this also eliminates the @option{-I} command-line option,
   2110 which inhibits the reading of nanorc files.
   2111 
   2112 @item --disable-operatingdir
   2113 Exclude the code for setting an operating directory.  This also eliminates
   2114 the @option{-o} command-line option, which sets the operating directory.
   2115 
   2116 @item --disable-speller
   2117 Exclude the code for spell checking.  This also eliminates the @option{-s}
   2118 command-line option, which allows specifying an alternate spell checker.
   2119 
   2120 @item --disable-tabcomp
   2121 Exclude tab completion (when nano asks for a filename or search string
   2122 or replace string or command to execute).
   2123 
   2124 @item --disable-wordcomp
   2125 Exclude word completion (@kbd{^]}).
   2126 
   2127 @item --disable-wrapping
   2128 Exclude all hard-wrapping of overlong lines.  This also eliminates the
   2129 @option{-b} and @option{-w} command-line options, which switch automatic
   2130 long-line wrapping on and off, respectively.
   2131 
   2132 @item --enable-tiny
   2133 This option implies all of the above.  It also disables some other
   2134 internals of the editor, like the function toggles, the marking of text,
   2135 the undo/redo code, line anchors, the recording and playback of a macro,
   2136 softwrapping, and the cut-to-end-of-line code.  These things stay disabled
   2137 also when using the enabling counterpart of the above options together with
   2138 @option{--enable-tiny} to switch specific features back on.
   2139 
   2140 @item --enable-debug
   2141 Include some code for runtime debugging output.  This can get messy, so
   2142 chances are you only want this feature when you're working on the nano source.
   2143 
   2144 @item --disable-nls
   2145 Exclude Native Language support.  This disables the use of any
   2146 available GNU @command{nano} translations.
   2147 
   2148 @item --enable-utf8
   2149 Include support for handling and displaying Unicode files.
   2150 This requires a "wide" version of the curses library.
   2151 
   2152 @item --disable-utf8
   2153 Exclude support for handling and displaying Unicode files.  Normally the
   2154 configure script auto-detects whether to enable UTF-8 support or not.
   2155 You can use this or the previous option to override that detection.
   2156 
   2157 @item --enable-altrcname=@var{name}
   2158 Use the file with the given @var{name} (in the user's home directory)
   2159 as nano's settings file, instead of the default @code{.nanorc}.
   2160 
   2161 @end table
   2162 
   2163 @html
   2164 <hr>
   2165 @end html
   2166 
   2167 @iftex
   2168 @contents
   2169 @end iftex
   2170 
   2171 @bye