In the vi editor, which command replaces text continuously from the current cursor position to the right, until you exit replace mode?

Difficulty: Easy

Correct Answer: R

Explanation:


Introduction / Context:
Vi provides both single-character replacement and continuous replacement modes. Knowing the difference is important for efficient editing when making larger inline changes without deleting whole words or lines.


Given Data / Assumptions:

  • User is editing text in vi normal mode.
  • The goal is to overwrite multiple characters continuously.
  • We must distinguish between lowercase r and uppercase R.


Concept / Approach:

The uppercase R enters replace mode, where every keystroke overwrites existing characters until you press ESC. Lowercase r replaces only one character. This makes R the correct choice for replacing text from the cursor onward.


Step-by-Step Solution:

Open file in vi.Navigate to text to overwrite.Press R (uppercase).Type replacement text; existing characters are overwritten.Press ESC to return to normal mode.


Verification / Alternative check:

Compare with lowercase r: rX replaces one character with X only. With R, typing 'HELLO' overwrites five existing characters until stopped.


Why Other Options Are Wrong:

  • S: changes entire line and enters insert mode.
  • s: substitutes one character and enters insert mode for further input.
  • r: replaces only a single character.
  • None: incorrect because R is correct.


Common Pitfalls:

  • Confusing R with r; lowercase affects one character only.
  • Forgetting to press ESC to exit replace mode.


Final Answer:

R.

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion