2.4.2 Killing and Yanking
Killing text means to delete the text from the line, but to save it away for later use, usually by yanking it back into the line. If the description for a command says that it ‘kills’ text, then you can be sure that you can get the text back in a different (or the same) place later.
Here is the list of commands for killing text.
- C-k
-
Kill the text from the current cursor position to the end of the line.
- M-d
-
Kill from the cursor to the end of the current word, or if between words, to the end of the next word.
- M-DEL
-
Kill from the cursor to the start of the previous word, or if between words, to the start of the previous word.
- C-w
Kill from the cursor to the previous whitespace. This is different than M-DEL because the word boundaries differ.
And, here is how to yank the text back into the line. Yanking means to copy the most-recently-killed text from the kill buffer.
- C-y
-
Yank the most recently killed text back into the buffer at the cursor.
- M-y
Rotate the kill-ring, and yank the new top. You can only do this if the prior command is C-y or M-y.
When you use a kill command, the text is saved in a kill-ring. Any number of consecutive kills save all of the killed text together, so that when you yank it back, you get it in one clean sweep. The kill ring is not line specific; the text that you killed on a previously typed line is available to be yanked back later, when you are typing another line.
© 1996–2020 John W. Eaton
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions.
https://octave.org/doc/v6.3.0/Killing-and-Yanking.html