LFCS · Question #809
In the vi editor, which of the following commands will copy the current line into the vi buffer?
The correct answer is D. yy. This question tests knowledge of basic line manipulation commands within the vi text editor, specifically for copying a line.
Question
Options
- Ac
- Bcc
- C1c
- Dyy
- E1y
How the community answered
(31 responses)- B3% (1)
- D90% (28)
- E6% (2)
Why each option
This question tests knowledge of basic line manipulation commands within the `vi` text editor, specifically for copying a line.
`c` (change) is a command to change characters, requiring a motion command, and puts `vi` into insert mode after deleting.
`cc` (change line) cuts the current line and immediately puts `vi` into insert mode, deleting the line's content rather than just copying it.
`1c` is not a standard `vi` command for copying a line; it would initiate a change operation on one character.
In `vi`'s normal mode, the `yy` command (yank current line) copies the entire current line into the unnamed buffer. This allows the line to be pasted elsewhere using the `p` or `P` command.
`1y` is not the standard `vi` command for yanking the current line; `yy` is the correct two-character command for this action.
Concept tested: vi editor line copying (yanking)
Source: https://www.freebsd.org/cgi/man.cgi?query=vi&sektion=1
Topics
Community Discussion
No community discussion yet for this question.