Exam LFCS All QuestionsBrowse all questions from this exam
Question 61

In the vi editor, how can commands such as moving the cursor or copying lines into the buffer be issued multiple times or applied to multiple rows?

    Correct Answer: B

    In the vi editor, commands can be repeated multiple times by specifying the number directly in front of the command. For example, using 4l moves the cursor four characters to the right, and 2yj copies the current line and the line below it into the buffer. This method of prefixing commands with numbers allows for efficient batch operations in vi.

Discussion
rona962Option: B

In the vi editor, commands such as moving the cursor or copying lines into the buffer can be issued multiple times or applied to multiple rows by specifying the number right in front of the command. Therefore, the correct option is B. This is known as a repetition factor, and it allows you to execute a command multiple times on a range of lines. For example, you can use 4l to move the cursor four characters to the right, or 2yj to copy the current line and the line below it into the buffer. Note that not all commands can be repeated this way, but many of the basic editing commands in vi support this feature. Additionally, you can combine repetition factors with other commands to perform more complex operations, such as 3dw to delete the next three words.