Difficulty: Easy
Correct Answer: R
Explanation:
Introduction / Context:
vi and its modern descendant vim provide several modes. Knowing how to enter Replace mode allows you to overstrike existing text instead of inserting and shifting it. This is handy when you want to overwrite a whole line quickly from the cursor position.
Given Data / Assumptions:
Concept / Approach:
In vi, pressing R
enters Replace mode. Characters you type overwrite existing characters until you press Escape to return to normal mode. This differs from lowercase r
, which replaces only a single character. Other keys like u
(undo), v
(visual mode), and C
(change to end of line) serve different purposes and do not perform continuous overstrike.
Step-by-Step Solution:
0
) or where overstriking should begin.Press R
to enter Replace mode; notice the status indicator in vim.Type the new content; each keystroke overwrites existing characters.Press Esc
to exit Replace mode when finished.
Verification / Alternative check:
Experiment in a test file: type some text, press R
, then type a different phrase of the same or longer length. You will see characters overwritten rather than inserted; if longer, following text is overwritten as you continue.
Why Other Options Are Wrong:
c$
), which deletes then enters insert mode, not overstrike.R
is correct.
Common Pitfalls:
Confusing R
with r
(single-character replace); attempting to overstrike in Insert mode; forgetting to press Esc
to leave Replace mode before running other commands.
Final Answer:
R
Discussion & Comments