There are two ways of removing text: deletion, after which the deleted text is not recoverable (except with the Undo command); and killing, which appends the deleted text to the kill ring, so that it may be recovered using the Un-Kill and Rotate Kill Ring commands. The first section contains details of commands to delete text, and the second details of commands to kill text.
Note that, if Delete Selection Mode is active, then any currently selected text is deleted when text is entered. 3.13 Delete Selection for details.
The use of prefix arguments with this set of commands can be very useful. In general, using a negative prefix argument repeats these commands a certain number of times in the opposite logical direction. For example, the key sequence Ctrl+U 10
Meta
+D
deletes 10 words after the current point, but the key sequence Ctrl+U -10
Meta
+D
deletes 10 words before the current point.
Delete Next Character Editor Command
Arguments: None
Key sequence: Ctrl+D
Key sequence: Delete
Deletes the character immediately after the current point.
Delete Previous Character Editor Command
Arguments: None
Key sequence: Backspace
Deletes the character immediately before the current point.
Delete Previous Character Expanding Tabs Editor Command
Arguments: None
Key sequence: None
Deletes the character immediately before the current point, but if the previous character is a Tab
, then this is expanded into the equivalent number of spaces, so that the apparent space is reduced by one.
A prefix argument deletes the required number of characters, but if any of them are tabs, the equivalent spaces are inserted before the deletion continues.
Delete Horizontal Space Editor Command
Arguments: None
Key sequence: Meta
+\
Deletes all spaces on the line surrounding the current point.
Arguments: None
Key sequence: Meta
+Space
Deletes all space on the current line surrounding the current point and then inserts a single space. If there was initially no space around the current point, a single space is inserted.
Delete Blank Lines Editor Command
Arguments: None
Key sequence: Ctrl+X Ctrl+O
If the current point is on a blank line, all surrounding blank lines are deleted, leaving just one. If the current point is on a non-blank line, all following blank lines up to the next non-blank line are deleted.
Arguments: None
Key sequence: None
Delete the current region. Also available via editor:delete-region-command
.
Arguments: None
Key sequence: None
Deletes the text in a Listener, leaving you with a prompt. Undo information is not retained, although you are warned about this before confirming the command.
This command is useful if the Listener session has grown very large.
Arguments: None
Key sequence: None
Deletes the text in the Output tab of a Listener or Editor tool, or an Output Browser. Undo information is discarded without warning.
This command is useful if the output has grown very large.
Most of these commands result in text being pushed onto the kill ring so that it can be recovered. There is only one kill ring for all buffers so that text can be copied from one buffer to another.
Normally each kill command pushes a new block of text onto the kill ring. However, if more than one kill command is issued sequentially, and the text being killed was next to the previously killed text, they form a single entry in the kill ring (exceptions being Kill Region and Save Region).
Append Next Kill is different in that it affects where a subsequent killed text is stored in the kill ring, but does not itself modify the kill ring.
Arguments: None
Key sequence: Meta
+D
Kills the rest of the word after the current point. If the current point is between two words, then the next word is killed.
Kill Previous Word Editor Command
Arguments: None
Key sequence: Meta
+Backspace
Kills the rest of the word before the current point. If the current point is between two words, then the previous word is killed.
Arguments: None
Key sequence: Ctrl+K
Kills the characters from the current point up to the end of the current line. If the line is empty then the line is deleted.
Backward Kill Line Editor Command
Arguments: None
Key sequence: None
Kills the characters from the current point to the beginning of the line. If the current point is already at the beginning of the line, the current line is joined to the previous line, with any trailing space on the previous line killed.
Forward Kill Sentence Editor Command
Arguments: None
Key sequence: Meta
+K
Kills the text starting from the current point up to the end of the sentence. If the current point is between two sentences, then the whole of the next sentence is killed.
Backward Kill Sentence Editor Command
Arguments: None
Key sequence: Ctrl+X Backspace
Kills the text starting from the current point up to the beginning of the sentence. If the current point is between two sentences, then the whole of the previous sentence is killed.
Arguments: None
Key sequence: Ctrl+W
Kills the region between the current point and the mark.
Arguments: None
Key sequence: Meta
+W
Pushes the region between the current point and the mark onto the kill ring without deleting it from the buffer. Text saved in this way can therefore be inserted elsewhere without first being killed.
Append Next Kill Editor Command
Arguments: None
Key sequence: Meta
+Ctrl+W
If the next command entered kills any text then this text will be appended to the existing kill text instead of being pushed separately onto the kill ring.
Arguments: None
Key sequence: Meta
+Z
Prompts for a character and kills text from the current point to the next occurrence of that character in the current buffer. If a prefix argument p is used, then it kills to the p'th occurrence. If p is negative, then it kills backwards.
An editor error is signaled if the character cannot be found in the buffer.
Editor User Guide (Macintosh version) - 01 Dec 2021 19:35:09