docs: move the chapter about editor basics into third position

Or rather, move the chapter about command-line options to between
the chapters on file browser and feature toggles.  Also, rename the
chapter about the built-in help, and move the section about screen
layout to be the first in the editor-basics chapter.
This commit is contained in:
Benno Schulenberg 2021-10-19 15:50:05 +02:00
parent e63fe3be69
commit 108c84daf8

View File

@ -81,10 +81,10 @@ This manual documents GNU @command{nano}, version 5.9.
@menu
* Introduction::
* Invoking::
* Command-line Options::
* Editor Basics::
* Built-in Help::
* The Help Viewer::
* The File Browser::
* Command-line Options::
* Feature Toggles::
* Nanorc Files::
* Pico Compatibility::
@ -135,8 +135,8 @@ The usual way to invoke @command{nano} is:
@end example
@blankline
But it is also possible to specify one or more options (see the next
section), and to edit several files in a row. Additionally, the cursor
But it is also possible to specify one or more options (@pxref{Command-line Options}),
and to edit several files in a row. Additionally, the cursor
can be put on a specific line of a file by adding the line number
with a plus sign before the filename, and even in a specific column by
adding it with a comma.
@ -166,6 +166,203 @@ will read data from standard input. This means you can pipe the output of
a command straight into a buffer, and then edit it.
@node Editor Basics
@chapter Editor Basics
@menu
* Screen Layout::
* Entering Text::
* Commands::
* The Cutbuffer::
* The Mark::
* Search and Replace::
* Using the Mouse::
* Anchors::
* Limitations::
@end menu
@node Screen Layout
@section Screen Layout
The default screen of nano consists of five areas. From top to bottom
these are: the title bar, a blank line, the edit window, the status bar,
and two help lines.
The title bar consists of
three sections: left, center and right. The section on the left
displays the version of @command{nano} being used. The center section
displays the current filename, or "New Buffer" if the file has not yet
been named. The section on the right displays "Modified" if the
file has been modified since it was last saved or opened.
The status bar is the third line from the bottom of the screen. It
shows important and informational messages. Any error messages that
occur from using the editor will appear on the status bar. Any questions
that are asked of the user will be asked on the status bar, and any user
input (search strings, filenames, etc.) will be input on the status bar.
The two help lines at the bottom of the screen show some of the most
essential functions of the editor. These two lines are called the
Shortcut List.
@node Entering Text
@section Entering Text
@command{nano} is a "modeless" editor. This means that all keystrokes,
with the exception of Control and Meta sequences, enter text into the
file being edited.
Characters not present on the keyboard can be entered in two ways:
@itemize @bullet
@item
For characters with a single-byte code,
pressing the Esc key twice and then typing a three-digit decimal number
(from @kbd{000} to @kbd{255}) will make @command{nano} behave as if you
typed the key with that value.
@item
For any possible character, pressing @kbd{M-V} (Alt+V) and then typing a
six-digit hexadecimal number (starting with @kbd{0} or @kbd{1}) will enter the
corresponding Unicode character into the buffer.
@end itemize
For example, typing @kbd{Esc Esc 2 3 4} will enter the character "ê" ---
useful when writing about a French party. Typing @kbd{M-V 0 0 2 2 c 4}
will enter the symbol "⋄", a little diamond.
@node Commands
@section Commands
Commands are given by using the Control key (Ctrl, shown as @kbd{^})
or the Meta key (Alt or Cmd, shown as @kbd{M-}).
@itemize @bullet
@item
A control-key sequence is entered by holding down the Ctrl key and
pressing the desired key.
@item
A meta-key sequence is entered by holding down the Meta key (normally
the Alt key) and pressing the desired key.
@end itemize
If for some reason on your system the combinations with Ctrl or Alt do
not work, you can generate them by using the Esc key. A control-key
sequence is generated by pressing the Esc key twice and then pressing
the desired key, and a meta-key sequence by pressing the Esc key once
and then pressing the desired key.
@node The Cutbuffer
@section The Cutbuffer
Text can be cut from a file a whole line at a time with @kbd{^K}.
The cut line is stored in the cutbuffer. Consecutive strokes of @kbd{^K}
will add each cut line to this buffer, but a @kbd{^K}
after any other keystroke will overwrite the entire cutbuffer.
The contents of the cutbuffer can be pasted at the current cursor position
with @kbd{^U}.
A line of text can be copied into the cutbuffer (without cutting it)
with @kbd{M-6}.
@node The Mark
@section The Mark
Text can be selected by first 'setting the Mark' with @kbd{^6}
or @kbd{M-A} and then moving the cursor to the other end of the portion
to be selected. The selected portion of text will be highlighted.
This selection can now be cut or copied in its entirety with a single
@kbd{^K} or @kbd{M-6}. Or the selection can be used to limit the scope of
a search-and-replace (@kbd{^\}) or spell-checking session (@kbd{^T^T}).
On some terminals, text can be selected also by holding down @kbd{Shift}
while using the cursor keys. Holding down the @kbd{Ctrl} or @kbd{Alt}
key too will increase the stride. Such a selection is cancelled
upon any cursor movement where @kbd{Shift} isn't held.
Cutting or copying selected text toggles off the mark automatically.
If needed, it can be toggled off manually with another @kbd{^6} or @kbd{M-A}.
@node Search and Replace
@section Search and Replace
One can search the current buffer for the occurrence of any string
with the Search command (default key binding: @kbd{^W}). The default search
mode is forward, case-insensitive, and for literal strings. But one
can search backwards by pressing @kbd{M-B}, search case sensitively with @kbd{M-C},
and interpret regular expressions in the search string with @kbd{M-R}.
A regular expression in a search string always covers just one line;
it cannot span multiple lines. And when replacing (with @kbd{^\} or @kbd{M-R})
the replacement string cannot contain a newline (LF).
@node Using the Mouse
@section Using the Mouse
When mouse support has been configured and enabled, a single mouse click
places the cursor at the indicated position. Clicking a second time in
the same position toggles the mark. Clicking in the shortcut list
executes the selected shortcut. To be able to select text with the
left button, or paste text with the middle button, hold down the
Shift key during those actions.
The mouse will work in the X Window System, and on the console when gpm
is running.
@node Anchors
@section Anchors
With @kbd{M-Ins} you can place an anchor (a kind of temporary bookmark)
at the current line. With @kbd{M-PgUp} and @kbd{M-PgDn} you can jump
to an anchor in the backward/forward direction. This jumping wraps
around at the top and bottom.
When a line with an anchor is removed, the line where the cursor ends up
inherits the anchor. After performing an operation on the entire buffer
(like formatting it, piping it through a command, or doing an external
spell check on it), any anchors that were present are gone. And when
you close the buffer, all its anchors simply disappear; they are not saved.
Anchors are visualized in the margin when line numbers are activated.
@node Limitations
@section Limitations
The recording and playback of keyboard macros works correctly only on a
terminal emulator, not on a Linux console (VT), because the latter does
not by default distinguish modified from unmodified arrow keys.
@node The Help Viewer
@chapter The Help Viewer
The built-in help system in @command{nano} is available by pressing @kbd{^G}.
It is fairly self-explanatory. It documents the various parts of the
editor and the available keystrokes. Navigation is via the @kbd{^Y} (Page Up)
and @kbd{^V} (Page Down) keys. @kbd{^X} exits from the help system.
@node The File Browser
@chapter The File Browser
When in the Read-File (@kbd{^R}) or Write-Out menu (@kbd{^O}),
pressing @kbd{^T} will invoke the file browser.
Here, one can navigate directories in a graphical manner in order to
find the desired file.
Basic movement in the file browser is accomplished with the arrow and
other cursor-movement keys. More targeted movement is accomplished by
searching, via @kbd{^W} or @kbd{w}, or by changing directory, via
@kbd{^_} or @kbd{g}. The behavior of the @kbd{Enter} key (or @kbd{s})
varies by what is currently selected.
If the currently selected object is a directory, the file browser will
enter and display the contents of the directory. If the object is a
file, this filename and path are copied to the status bar, and the file
browser exits.
@node Command-line Options
@chapter Command-line Options
@ -513,203 +710,6 @@ try using libmagic to determine the applicable syntax.
@end table
@node Editor Basics
@chapter Editor Basics
@menu
* Entering Text::
* Commands::
* The Cutbuffer::
* The Mark::
* Screen Layout::
* Search and Replace::
* Using the Mouse::
* Anchors::
* Limitations::
@end menu
@node Entering Text
@section Entering Text
@command{nano} is a "modeless" editor. This means that all keystrokes,
with the exception of Control and Meta sequences, enter text into the
file being edited.
Characters not present on the keyboard can be entered in two ways:
@itemize @bullet
@item
For characters with a single-byte code,
pressing the Esc key twice and then typing a three-digit decimal number
(from @kbd{000} to @kbd{255}) will make @command{nano} behave as if you
typed the key with that value.
@item
For any possible character, pressing @kbd{M-V} (Alt+V) and then typing a
six-digit hexadecimal number (starting with @kbd{0} or @kbd{1}) will enter the
corresponding Unicode character into the buffer.
@end itemize
For example, typing @kbd{Esc Esc 2 3 4} will enter the character "ê" ---
useful when writing about a French party. Typing @kbd{M-V 0 0 2 2 c 4}
will enter the symbol "⋄", a little diamond.
@node Commands
@section Commands
Commands are given by using the Control key (Ctrl, shown as @kbd{^})
or the Meta key (Alt or Cmd, shown as @kbd{M-}).
@itemize @bullet
@item
A control-key sequence is entered by holding down the Ctrl key and
pressing the desired key.
@item
A meta-key sequence is entered by holding down the Meta key (normally
the Alt key) and pressing the desired key.
@end itemize
If for some reason on your system the combinations with Ctrl or Alt do
not work, you can generate them by using the Esc key. A control-key
sequence is generated by pressing the Esc key twice and then pressing
the desired key, and a meta-key sequence by pressing the Esc key once
and then pressing the desired key.
@node The Cutbuffer
@section The Cutbuffer
Text can be cut from a file a whole line at a time with @kbd{^K}.
The cut line is stored in the cutbuffer. Consecutive strokes of @kbd{^K}
will add each cut line to this buffer, but a @kbd{^K}
after any other keystroke will overwrite the entire cutbuffer.
The contents of the cutbuffer can be pasted at the current cursor position
with @kbd{^U}.
A line of text can be copied into the cutbuffer (without cutting it)
with @kbd{M-6}.
@node The Mark
@section The Mark
Text can be selected by first 'setting the Mark' with @kbd{^6}
or @kbd{M-A} and then moving the cursor to the other end of the portion
to be selected. The selected portion of text will be highlighted.
This selection can now be cut or copied in its entirety with a single
@kbd{^K} or @kbd{M-6}. Or the selection can be used to limit the scope of
a search-and-replace (@kbd{^\}) or spell-checking session (@kbd{^T^T}).
On some terminals, text can be selected also by holding down @kbd{Shift}
while using the cursor keys. Holding down the @kbd{Ctrl} or @kbd{Alt}
key too will increase the stride. Such a selection is cancelled
upon any cursor movement where @kbd{Shift} isn't held.
Cutting or copying selected text toggles off the mark automatically.
If needed, it can be toggled off manually with another @kbd{^6} or @kbd{M-A}.
@node Screen Layout
@section Screen Layout
The default screen of nano consists of five areas. From top to bottom
these are: the title bar, a blank line, the edit window, the status bar,
and two help lines.
The title bar consists of
three sections: left, center and right. The section on the left
displays the version of @command{nano} being used. The center section
displays the current filename, or "New Buffer" if the file has not yet
been named. The section on the right displays "Modified" if the
file has been modified since it was last saved or opened.
The status bar is the third line from the bottom of the screen. It
shows important and informational messages. Any error messages that
occur from using the editor will appear on the status bar. Any questions
that are asked of the user will be asked on the status bar, and any user
input (search strings, filenames, etc.) will be input on the status bar.
The two help lines at the bottom of the screen show some of the most
essential functions of the editor. These two lines are called the
Shortcut List.
@node Search and Replace
@section Search and Replace
One can search the current buffer for the occurrence of any string
with the Search command (default key binding: @kbd{^W}). The default search
mode is forward, case-insensitive, and for literal strings. But one
can search backwards by pressing @kbd{M-B}, search case sensitively with @kbd{M-C},
and interpret regular expressions in the search string with @kbd{M-R}.
A regular expression in a search string always covers just one line;
it cannot span multiple lines. And when replacing (with @kbd{^\} or @kbd{M-R})
the replacement string cannot contain a newline (LF).
@node Using the Mouse
@section Using the Mouse
When mouse support has been configured and enabled, a single mouse click
places the cursor at the indicated position. Clicking a second time in
the same position toggles the mark. Clicking in the shortcut list
executes the selected shortcut. To be able to select text with the
left button, or paste text with the middle button, hold down the
Shift key during those actions.
The mouse will work in the X Window System, and on the console when gpm
is running.
@node Anchors
@section Anchors
With @kbd{M-Ins} you can place an anchor (a kind of temporary bookmark)
at the current line. With @kbd{M-PgUp} and @kbd{M-PgDn} you can jump
to an anchor in the backward/forward direction. This jumping wraps
around at the top and bottom.
When a line with an anchor is removed, the line where the cursor ends up
inherits the anchor. After performing an operation on the entire buffer
(like formatting it, piping it through a command, or doing an external
spell check on it), any anchors that were present are gone. And when
you close the buffer, all its anchors simply disappear; they are not saved.
Anchors are visualized in the margin when line numbers are activated.
@node Limitations
@section Limitations
The recording and playback of keyboard macros works correctly only on a
terminal emulator, not on a Linux console (VT), because the latter does
not by default distinguish modified from unmodified arrow keys.
@node Built-in Help
@chapter Built-in Help
The built-in help system in @command{nano} is available by pressing @kbd{^G}.
It is fairly self-explanatory. It documents the various parts of the
editor and the available keystrokes. Navigation is via the @kbd{^Y} (Page Up)
and @kbd{^V} (Page Down) keys. @kbd{^X} exits from the help system.
@node The File Browser
@chapter The File Browser
When in the Read-File (@kbd{^R}) or Write-Out menu (@kbd{^O}),
pressing @kbd{^T} will invoke the file browser.
Here, one can navigate directories in a graphical manner in order to
find the desired file.
Basic movement in the file browser is accomplished with the arrow and
other cursor-movement keys. More targeted movement is accomplished by
searching, via @kbd{^W} or @kbd{w}, or by changing directory, via
@kbd{^_} or @kbd{g}. The behavior of the @kbd{Enter} key (or @kbd{s})
varies by what is currently selected.
If the currently selected object is a directory, the file browser will
enter and display the contents of the directory. If the object is a
file, this filename and path are copied to the status bar, and the file
browser exits.
@node Feature Toggles
@chapter Feature Toggles