nerdexam
Linux_Foundation

LFCS · Question #799

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?

The correct answer is B. By specifying the number right in front of a command such as 4l or 2yj. In the vi editor, commands can be executed multiple times or applied to multiple units by prefixing them with a numerical count.

Submitted by salim_om· Apr 18, 2026Essential Commands

Question

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?

Options

  • ABy using the command :repeat followed by the number and the command.
  • BBy specifying the number right in front of a command such as 4l or 2yj.
  • CBy selecting all affected lines using the shift and cursor keys before applying the command.
  • DBy issuing a command such as :set repetition=4 which repeats every subsequent command 4

How the community answered

(35 responses)
  • A
    3% (1)
  • B
    91% (32)
  • D
    6% (2)

Why each option

In the `vi` editor, commands can be executed multiple times or applied to multiple units by prefixing them with a numerical count.

ABy using the command :repeat followed by the number and the command.

There is no standard `:repeat` command in `vi` for repeating actions; numerical prefixes are the primary method.

BBy specifying the number right in front of a command such as 4l or 2yj.Correct

Many `vi` commands can be preceded by a number, which specifies how many times the command should be performed. For instance, `4l` moves the cursor four positions to the right, and `2yj` copies two lines.

CBy selecting all affected lines using the shift and cursor keys before applying the command.

While `vim` (an extended `vi`) has visual selection, standard `vi` primarily uses numerical prefixes for command repetition, and 'shift and cursor keys' are not the common way to select for command application in its original form.

DBy issuing a command such as :set repetition=4 which repeats every subsequent command 4

There is no `:set repetition=` command in `vi` to set a global repetition count; repetition is applied directly before each command.

Concept tested: vi editor command repetition

Source: https://man7.org/linux/man-pages/man1/vim.1.html

Topics

#vi editor#command repetition#text editing#cursor movement

Community Discussion

No community discussion yet for this question.

Full LFCS Practice