LFCS · Question #729
Immediately after deleting 3 lines of text in vi and moving the cursor to a different line, which single character command will insert the deleted content below the current line?
The correct answer is C. p (lowercase). In the vi editor, the lowercase p command pastes the contents of the unnamed register, typically the most recently deleted text, below the current line.
Question
Options
- Ai (lowercase)
- BP (uppercase)
- Cp (lowercase)
- DU (uppercase)
- Eu (lowercase)
How the community answered
(27 responses)- A4% (1)
- C93% (25)
- E4% (1)
Why each option
In the `vi` editor, the lowercase `p` command pastes the contents of the unnamed register, typically the most recently deleted text, below the current line.
The lowercase `i` command enters insert mode before the current cursor position, allowing text entry but not pasting.
The uppercase `P` command pastes the contents of the unnamed register before the cursor position, or above the current line.
The lowercase `p` command in `vi` pastes the contents of the unnamed register (which stores the last deleted or yanked text) after the cursor position, or below the current line when whole lines have been deleted.
The uppercase `U` command undoes all changes made on the current line since the cursor last moved to it.
The lowercase `u` command undoes the very last change made in the editor.
Concept tested: Vi editor paste command
Source: https://www.vim.org/docs.php
Topics
Community Discussion
No community discussion yet for this question.