📜 ⬆️ ⬇️

Nano: And yet he will have to learn [2]

We continue. Previous topic (text navigation): here .

Today's topic is working with selecting, copying, and deleting chunks of text.

To understand the principles of text commands, you must first understand the principle of text selection. It is carried out either by mouse or from the keyboard. From the keyboard, selection is as follows: first, the beginning of the selection is marked: Alt-A or Ctrl- ^ . This is followed by navigation — and until the action is performed on the text in the buffer, the selection remains (note that the selection remains even when you enter text, in this it is very different from the selection in windows gui applications and closer to the persistent blocks in TurboC, DN and the corresponding options Far Manager'a).
Please note that all navigation features are applicable, including skipping by line number or searching (in future releases).

Further, the selected text can be deleted or copied to the buffer. This makes the combination Ctrl-K (or F9 ).

The selected text can be copied to the clipboard - a combination of Alt-6 (yes, we LOVE nano).

Next, we can paste the text from the clipboard - Ctrl-U or F10 . Please note - in the hint from the bottom it is written wrong, this is not cancel deletion, this is an insert.

In addition, for ease of editing, Ctrl-K deletes the line if there is no selection. Either entirely, or from the cursor to the end of the line. The behavior is switched by the Alt-K combination (by default, the mode is to delete the entire line, and Alt-K switches it back and forth).

Note that the deleted line is in the buffer, so it can be inserted using Ctrl-U .

Another lazy combination is Alt-T , which erases everything from the cursor to the end of the file (the trunkate command).

To insert text from another file, the Ins button is used (I think all vim users are well aware of the behavior of this button in nano).

To be continued

Source: https://habr.com/ru/post/106554/

All Articles