All Manuals > Editor User Guide > 2 General Concepts

2.6 Basic editing commands

This section contains just enough information to allow you to load a file into the editor, edit that file as required, and then save that file. It is designed to give you enough information to get by and no more.

Only the default bindings are provided. The commands introduced are grouped together as they are in the more detailed command references and under the same headings (except for 2.6.7 Killing and Yanking). For further information on the commands described below and other related commands, see the relevant sections in 3 Command Reference.

2.6.1 Aborting commands and processes

See 3.1 Aborting commands and processes.

Ctrl+G
Abort the current command which may either be running or just partially typed in. Use Esc in macOS editor emulation.

2.6.2 File handling

See 3.5 File handling.

Ctrl+X Ctrl+F file

Load file into a buffer ready for editing. If the name of a non-existent file is given, then an empty buffer is created in to which text can be inserted. Only when a save is done will the file be created.

Ctrl+X Ctrl+S
Save the contents of the current buffer to the associated file. If there is no associated file, one is created with the same name as the buffer.

2.6.3 Inserting text

See 3.12 Inserting text for details of various commands which insert text.

Text which is typed in at the keyboard is automatically inserted to the left of the cursor.

To insert a newline press Return.

2.6.4 Movement

See 3.8 Movement.

Ctrl+F
Move the cursor forward one character.
Ctrl+B
Move the cursor backward one character.
Ctrl+N
Move the cursor down one line.
Ctrl+P
Move the cursor up one line.

The above commands can also be executed using the arrow keys.

Ctrl+A
Move the cursor to the beginning of the line.
Ctrl+E
Move the cursor to the end of the line.
Ctrl+V
Scroll one screen forward.
Meta+V
Scroll one screen backward.
Meta+Shift+<
Move to the beginning of the buffer.
Meta+Shift+>
Move to the end of the buffer.

2.6.5 Deleting and killing text

See 3.11 Deleting and killing text.

Delete
Delete the character to the left of the cursor.
Ctrl+D
Delete the current character.
Ctrl+K
Kill text from the cursor to the end of the line. To delete a whole line (that is, text and newline), type Ctrl+K twice at the start of the line.

2.6.6 Undoing

See 3.14 Undoing.

Ctrl+Shift+_
Undo the previous command. If Ctrl+Shift+_ is typed repeatedly, previously executed commands are undone in a "last executed, first undone" order.

2.6.7 Killing and Yanking

The commands given below are used to copy areas of text and insert them at some other point in the buffer. Note that there is no corresponding "Cut and paste" section in the command references, so direct cross references have been included with each command.

When cutting and pasting, the first thing to do is to copy the region of text to be moved. This is done by taking the cursor to the beginning of the piece of text to be copied and pressing Ctrl+Space to set a mark, and then taking the cursor to the end of the text and pressing Ctrl+W. This kills the region between the current point and the mark but keeps a copy of the killed text. This copy can then be inserted anywhere in the buffer by putting the cursor at the required position and then pressing Ctrl+Y to insert the copied text.

If the original text is to be copied but not killed, use the command Meta+W instead of Ctrl+W. This copies the text ready for insertion, but does not delete it.

Ctrl+Space
Set a mark for a region. See 3.9 Marks and regions.
Ctrl+W
Kill the region between the mark and current point, and save a copy of that region. See 3.11 Deleting and killing text.
Meta+W
Copy the region between the mark and the current point. See 3.11 Deleting and killing text.
Ctrl+Y
Insert (yank) a copied region before the current point. See 3.12 Inserting text.

2.6.8 Help

See 3.3 Help.

Ctrl+H A string
List symbols whose names contain string in a Symbol Browser tool.
Ctrl+H D command

Describe command, where command is the full command name.

Ctrl+H K key
Describe the command bound to key.

Editor User Guide (Macintosh version) - 01 Dec 2021 19:35:08