Blame doc/nano.1

Packit 1ac44c
.\" Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc.
Packit 1ac44c
.\"
Packit 1ac44c
.\" This document is dual-licensed.  You may distribute and/or modify it
Packit 1ac44c
.\" under the terms of either of the following licenses:
Packit 1ac44c
.\"
Packit 1ac44c
.\" * The GNU General Public License, as published by the Free Software
Packit 1ac44c
.\"   Foundation, version 3 or (at your option) any later version.  You
Packit 1ac44c
.\"   should have received a copy of the GNU General Public License
Packit 1ac44c
.\"   along with this program.  If not, see
Packit 1ac44c
.\"   <http://www.gnu.org/licenses/>.
Packit 1ac44c
.\"
Packit 1ac44c
.\" * The GNU Free Documentation License, as published by the Free
Packit 1ac44c
.\"   Software Foundation, version 1.2 or (at your option) any later
Packit 1ac44c
.\"   version, with no Invariant Sections, no Front-Cover Texts, and no
Packit 1ac44c
.\"   Back-Cover Texts.  You should have received a copy of the GNU Free
Packit 1ac44c
.\"   Documentation License along with this program.  If not, see
Packit 1ac44c
.\"   <http://www.gnu.org/licenses/>.
Packit 1ac44c
.\"
Packit 1ac44c
.TH NANO 1 "version 2.9.8" "June 2018"
Packit 1ac44c
Packit 1ac44c
.SH NAME
Packit 1ac44c
nano \- Nano's ANOther editor, an enhanced free Pico clone
Packit 1ac44c
Packit 1ac44c
.SH SYNOPSIS
Packit 1ac44c
.B nano
Packit 1ac44c
.RI [ options "] [[+" line [, column "]]\ " file "]..."
Packit 1ac44c
Packit 1ac44c
.SH DESCRIPTION
Packit 1ac44c
\fBnano\fP is a small and friendly editor.  It copies the look and feel
Packit 1ac44c
of Pico, but is free software, and implements several features that Pico
Packit 1ac44c
lacks, such as: opening multiple files, scrolling per line, undo/redo,
Packit 1ac44c
syntax coloring, line numbering, and soft-wrapping overlong lines.
Packit 1ac44c
Packit 1ac44c
When giving a filename on the command line, the cursor can be put on a
Packit 1ac44c
specific line by adding the line number with a plus sign (\fB+\fR) before
Packit 1ac44c
the filename, and even in a specific column by adding it with a comma.
Packit 1ac44c
Packit 1ac44c
As a special case: if instead of a filename a dash (\fB\-\fR) is given,
Packit 1ac44c
\fBnano\fR will read data from standard input.
Packit 1ac44c
Packit 1ac44c
.SH EDITING
Packit 1ac44c
Entering text and moving around in a file is straightforward: typing the
Packit 1ac44c
letters and using the normal cursor movement keys.  Commands are entered
Packit 1ac44c
by using the Control (^) and the Alt or Meta (M\-) keys.
Packit 1ac44c
Typing \fB^K\fR deletes the current line and puts it in the cutbuffer.
Packit 1ac44c
Consecutive \fB^K\fRs will put all deleted lines together in the cutbuffer.
Packit 1ac44c
Any cursor movement or executing any other command will cause the next
Packit 1ac44c
\fB^K\fR to overwrite the cutbuffer.  A \fB^U\fR will paste the current
Packit 1ac44c
contents of the cutbuffer at the current cursor position.
Packit 1ac44c
.PP
Packit 1ac44c
When a more precise piece of text needs to be cut or copied, one can mark
Packit 1ac44c
its start with \fB^6\fR, move the cursor to its end (the marked text will be
Packit 1ac44c
highlighted), and then use \fB^K\fR to cut it, or \fBM\-6\fR to copy it to the
Packit 1ac44c
cutbuffer.  One can also save the marked text to a file with \fB^O\fR, or
Packit 1ac44c
spell check it with \fB^T\fR.
Packit 1ac44c
.PP
Packit 1ac44c
On some terminals, text can be selected also by holding down Shift while
Packit 1ac44c
using the arrow keys.  Holding down the Alt key too will increase the stride.
Packit 1ac44c
Any cursor movement without Shift being held will cancel such a selection.
Packit 1ac44c
.PP
Packit 1ac44c
The two lines at the bottom of the screen show some important commands;
Packit 1ac44c
the built-in help (\fB^G\fR) lists all the available ones.
Packit 1ac44c
The default key bindings can be changed via a \fInanorc\fR file -- see
Packit 1ac44c
.BR nanorc (5).
Packit 1ac44c
Packit 1ac44c
.SH OPTIONS
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-A ", " \-\-smarthome
Packit 1ac44c
Make the Home key smarter.  When Home is pressed anywhere but at the
Packit 1ac44c
very beginning of non-whitespace characters on a line, the cursor will
Packit 1ac44c
jump to that beginning (either forwards or backwards).  If the cursor is
Packit 1ac44c
already at that position, it will jump to the true beginning of the
Packit 1ac44c
line.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-B ", " \-\-backup
Packit 1ac44c
When saving a file, back up the previous version of it, using the current
Packit 1ac44c
filename suffixed with a tilde (\fB~\fP).
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-C\ \fIdirectory ", " \-\-backupdir= \fIdirectory
Packit 1ac44c
Make and keep not just one backup file, but make and keep a uniquely
Packit 1ac44c
numbered one every time a file is saved -- when backups are enabled (\fB\-B\fR).
Packit 1ac44c
The uniquely numbered files are stored in the specified \fIdirectory\fR.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-D ", " \-\-boldtext
Packit 1ac44c
Use bold text instead of reverse video text.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-E ", " \-\-tabstospaces
Packit 1ac44c
Convert typed tabs to spaces.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-F ", " \-\-multibuffer
Packit 1ac44c
Read a file into a new buffer by default.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-G ", " \-\-locking
Packit 1ac44c
Use vim-style file locking when editing files.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-H ", " \-\-historylog
Packit 1ac44c
Save the last hundred search strings and replacement strings and
Packit 1ac44c
executed commands, so they can be easily reused in later sessions.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-I ", " \-\-ignorercfiles
Packit 1ac44c
Don't look at the system's \fInanorc\fR nor at the user's \fInanorc\fR.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-K ", " \-\-rebindkeypad
Packit 1ac44c
Interpret the numeric keypad keys so that they all work properly.  You
Packit 1ac44c
should only need to use this option if they don't, as mouse support
Packit 1ac44c
won't work properly with this option enabled.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-L ", " \-\-nonewlines
Packit 1ac44c
Don't automatically add a newline when a file does not end with one.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-M ", " \-\-trimblanks
Packit 1ac44c
Snip trailing whitespace from the wrapped line when automatic
Packit 1ac44c
hard-wrapping occurs or when text is justified.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-N ", " \-\-noconvert
Packit 1ac44c
Disable automatic conversion of files from DOS/Mac format.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-O ", " \-\-morespace
Packit 1ac44c
Use the blank line below the title bar as extra editing space.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-P ", " \-\-positionlog
Packit 1ac44c
For the 200 most recent files, log the last position of the cursor,
Packit 1ac44c
and place it at that position again upon reopening such a file.
Packit 1ac44c
.TP
Packit 1ac44c
.BR "\-Q ""\fIregex\fB""" ", " "\-\-quotestr=""" \fIregex """
Packit 1ac44c
Set the regular expression for matching the quoting part of a line.
Packit 1ac44c
This is used when justifying.
Packit 1ac44c
The default value is \fB"^([\ \\t]*([#:>|}]|//))+"\fP.
Packit 1ac44c
Note that \fB\\t\fP stands for an actual Tab.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-R ", " \-\-restricted
Packit 1ac44c
Restricted mode: don't read or write to any file not specified on the
Packit 1ac44c
command line; don't read any \fInanorc\fP files nor history files;
Packit 1ac44c
don't allow suspending nor spell checking;
Packit 1ac44c
don't allow a file to be appended to, prepended to, or saved under a
Packit 1ac44c
different name if it already has one; and don't use backup files.
Packit 1ac44c
This restricted mode is also accessible by invoking \fBnano\fP
Packit 1ac44c
with any name beginning with 'r' (e.g. "rnano").
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-S ", " \-\-smooth
Packit 1ac44c
Use smooth scrolling: text will scroll line-by-line, instead of the
Packit 1ac44c
usual chunk-by-chunk behavior.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-T\ \fInumber ", " \-\-tabsize= \fInumber
Packit 1ac44c
Set the size (width) of a tab to \fInumber\fP columns.  The value of
Packit 1ac44c
\fInumber\fP must be greater than 0.  The default value is 8.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-U ", " \-\-quickblank
Packit 1ac44c
Do quick status-bar blanking: status-bar messages will disappear after 1
Packit 1ac44c
keystroke instead of 25.  Note that option \fB\-c\fR (\fB\-\-constantshow\fR)
Packit 1ac44c
overrides this.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-V ", " \-\-version
Packit 1ac44c
Show the current version number and exit.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-W ", " \-\-wordbounds
Packit 1ac44c
Detect word boundaries differently by treating punctuation
Packit 1ac44c
characters as part of a word.
Packit 1ac44c
.TP
Packit 1ac44c
.BR "\-X ""\fIcharacters\fB""" ", " "\-\-wordchars=""" \fIcharacters """
Packit 1ac44c
Specify which other characters (besides the normal alphanumeric ones)
Packit 1ac44c
should be considered as part of a word.  This overrides option
Packit 1ac44c
\fB\-W\fR (\fB\-\-wordbounds\fR).
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-Y\ \fIname ", " \-\-syntax= \fIname
Packit 1ac44c
Specify the name of the syntax highlighting to use from among the ones
Packit 1ac44c
defined in the \fInanorc\fP files.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-a ", " \-\-atblanks
Packit 1ac44c
When doing soft line wrapping, wrap lines at whitespace
Packit 1ac44c
instead of always at the edge of the screen.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-c ", " \-\-constantshow
Packit 1ac44c
Constantly show the cursor position on the status bar.
Packit 1ac44c
Note that this overrides option \fB\-U\fR (\fB\-\-quickblank\fR).
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-d ", " \-\-rebinddelete
Packit 1ac44c
Interpret the Delete key differently so that both Backspace and Delete
Packit 1ac44c
work properly.  You should only need to use this option if Backspace
Packit 1ac44c
acts like Delete on your system.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-g ", " \-\-showcursor
Packit 1ac44c
Make the cursor visible in the file browser, putting it on the
Packit 1ac44c
highlighted item.  Useful for braille users.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-h ", " \-\-help
Packit 1ac44c
Show a summary of the available command-line options and exit.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-i ", " \-\-autoindent
Packit 1ac44c
Automatically indent a newly created line to the same number of tabs
Packit 1ac44c
and/or spaces as the previous line (or as the next line if the previous
Packit 1ac44c
line is the beginning of a paragraph).
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-k ", " \-\-cutfromcursor
Packit 1ac44c
Make the 'Cut Text' command (normally \fB^K\fR) cut from the current cursor
Packit 1ac44c
position to the end of the line, instead of cutting the entire line.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-l ", " \-\-linenumbers
Packit 1ac44c
Display line numbers to the left of the text area.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-m ", " \-\-mouse
Packit 1ac44c
Enable mouse support, if available for your system.  When enabled, mouse
Packit 1ac44c
clicks can be used to place the cursor, set the mark (with a double
Packit 1ac44c
click), and execute shortcuts.  The mouse will work in the X Window
Packit 1ac44c
System, and on the console when gpm is running.  Text can still be
Packit 1ac44c
selected through dragging by holding down the Shift key.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-n ", " \-\-noread
Packit 1ac44c
Treat any name given on the command line as a new file.  This allows
Packit 1ac44c
\fBnano\fR to write to named pipes: it will start with a blank buffer,
Packit 1ac44c
and will write to the pipe when the user saves the "file".  This way
Packit 1ac44c
\fBnano\fR can be used as an editor in combination with for instance
Packit 1ac44c
\fBgpg\fR without having to write sensitive data to disk first.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-o\ \fIdirectory ", " \-\-operatingdir= \fIdirectory
Packit 1ac44c
Set the operating directory.  This makes \fBnano\fP set up something
Packit 1ac44c
similar to a chroot.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-p ", " \-\-preserve
Packit 1ac44c
Preserve the XON and XOFF sequences (^Q and ^S) so they will be caught
Packit 1ac44c
by the terminal.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-q ", " \-\-quiet
Packit 1ac44c
Obsolete option.  Recognized but ignored.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-r\ \fInumber ", " \-\-fill= \fInumber
Packit 1ac44c
Hard-wrap lines at column \fInumber\fP.  If this value is 0 or less, wrapping
Packit 1ac44c
will occur at the width of the screen less \fInumber\fP columns, allowing
Packit 1ac44c
the wrap point to vary along with the width of the screen if the screen
Packit 1ac44c
is resized.  The default value is \-8.  This option conflicts with
Packit 1ac44c
\fB\-w\fR (\fB\-\-nowrap\fR) -- the last one given takes effect.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-s\ \fIprogram ", " \-\-speller= \fIprogram
Packit 1ac44c
Use this alternative spell checker command.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-t ", " \-\-tempfile
Packit 1ac44c
Save a changed buffer without prompting (when exiting with \fB^X\fR).
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-u ", " \-\-unix
Packit 1ac44c
Save a file by default in Unix format.  This overrides nano's
Packit 1ac44c
default behavior of saving a file in the format that it had.
Packit 1ac44c
(This option has no effect when you also use \fB\-\-noconvert\fR.)
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-v ", " \-\-view
Packit 1ac44c
Just view the file and disallow editing: read-only mode.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-w ", " \-\-nowrap
Packit 1ac44c
Disable the hard-wrapping of long lines.  This option conflicts with
Packit 1ac44c
\fB\-r\fR (\fB\-\-fill\fR) -- the last one given takes effect.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-x ", " \-\-nohelp
Packit 1ac44c
Don't show the two help lines at the bottom of the screen.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-y ", " \-\-afterends
Packit 1ac44c
Make Ctrl+Right stop at word ends instead of beginnings.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-z ", " \-\-suspend
Packit 1ac44c
Enable the suspend ability.
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-$ ", " \-\-softwrap
Packit 1ac44c
Enable 'soft wrapping'.  This will make \fBnano\fP attempt to display the
Packit 1ac44c
entire contents of any line, even if it is longer than the screen width, by
Packit 1ac44c
continuing it over multiple screen lines.  Since
Packit 1ac44c
\&'$' normally refers to a variable in the Unix shell, you should specify
Packit 1ac44c
this option last when using other options (e.g.\& 'nano \-wS$') or pass it
Packit 1ac44c
separately (e.g.\& 'nano \-wS \-$').
Packit 1ac44c
.TP
Packit 1ac44c
.BR \-b ", " \-e ", " \-f ", " \-j
Packit 1ac44c
Ignored, for compatibility with Pico.
Packit 1ac44c
Packit 1ac44c
.SH TOGGLES
Packit 1ac44c
Several of the above options can be switched on and off also while
Packit 1ac44c
\fBnano\fR is running.  For example, \fBM\-L\fR toggles the
Packit 1ac44c
hard-wrapping of long lines, \fBM\-$\fR toggles soft-wrapping,
Packit 1ac44c
\fBM\-#\fR toggles line numbers, \fBM\-M\fR toggles the mouse,
Packit 1ac44c
\fBM\-I\fR auto-indentation, and \fBM\-X\fR the help lines.
Packit 1ac44c
See at the end of the \fB^G\fR help text for a complete list.
Packit 1ac44c
Packit 1ac44c
.SH INITIALIZATION FILE
Packit 1ac44c
\fBnano\fR will read two configuration files: first the system's
Packit 1ac44c
\fInanorc\fR (if it exists), and then the user's \fInanorc\fR (if it
Packit 1ac44c
exists), either \fB~/.nanorc\fR or \fI$XDG_CONFIG_HOME\fB/nano/nanorc\fR
Packit 1ac44c
or \fB~/.config/nano/nanorc\fR, whichever is encountered first.  See
Packit 1ac44c
.BR nanorc (5)
Packit 1ac44c
for more information on the possible contents of those files.
Packit 1ac44c
Packit 1ac44c
.SH NOTES
Packit 1ac44c
If no alternative spell checker command is specified on the command
Packit 1ac44c
line nor in one of the \fInanorc\fP files, \fBnano\fP will check the
Packit 1ac44c
\fBSPELL\fP environment variable for one.
Packit 1ac44c
.sp
Packit 1ac44c
In some cases \fBnano\fP will try to dump the buffer into an emergency
Packit 1ac44c
file.  This will happen mainly if \fBnano\fP receives a SIGHUP or
Packit 1ac44c
SIGTERM or runs out of memory.  It will write the buffer into a file
Packit 1ac44c
named \fInano.save\fP if the buffer didn't have a name already, or will
Packit 1ac44c
add a ".save" suffix to the current filename.  If an emergency file with
Packit 1ac44c
that name already exists in the current directory, it will add ".save"
Packit 1ac44c
plus a number (e.g.\& ".save.1") to the current filename in order to make
Packit 1ac44c
it unique.  In multibuffer mode, \fBnano\fP will write all the open
Packit 1ac44c
buffers to their respective emergency files.
Packit 1ac44c
Packit 1ac44c
.SH BUGS
Packit 1ac44c
Justifications (\fB^J\fR)
Packit 1ac44c
are not yet covered by the general undo system.  So after a justification
Packit 1ac44c
that is not immediately undone, earlier edits
Packit 1ac44c
cannot be undone any more.  The workaround is, of course, to exit without
Packit 1ac44c
saving.
Packit 1ac44c
.sp
Packit 1ac44c
The recording and playback of keyboard macros works correctly only on a
Packit 1ac44c
terminal emulator, not on a Linux console (VT), because the latter does
Packit 1ac44c
not by default distinguish modified from unmodified arrow keys.
Packit 1ac44c
.sp
Packit 1ac44c
Please report any other bugs that you encounter via:
Packit 1ac44c
.br
Packit 1ac44c
\fIhttps://savannah.gnu.org/bugs/?group=nano\fR.
Packit 1ac44c
.sp
Packit 1ac44c
When nano crashes, it will save any modified buffers to emergency .save files.
Packit 1ac44c
If you are able to reproduce the crash and you want to get a backtrace, define
Packit 1ac44c
the environment variable \fBNANO_NOCATCH\fR.
Packit 1ac44c
Packit 1ac44c
.SH HOMEPAGE
Packit 1ac44c
\fIhttps://nano-editor.org/\fR
Packit 1ac44c
Packit 1ac44c
.SH SEE ALSO
Packit 1ac44c
.BR nanorc (5)
Packit 1ac44c
.PP
Packit 1ac44c
\fI/usr/share/doc/nano/\fP (or equivalent on your system)
Packit 1ac44c
Packit 1ac44c
.SH AUTHOR
Packit 1ac44c
Chris Allegretta and others (see the files \fIAUTHORS\fR and
Packit 1ac44c
\fITHANKS\fP for details).  This manual page was originally written by
Packit 1ac44c
Jordi Mallach for the Debian system (but may be used by others).