Difficulty: Easy
Correct Answer: r
Explanation:
Introduction / Context:
Vim/vi provides powerful one-keystroke editing commands for rapid text manipulation. Knowing which key performs a single-character replacement saves time and reduces errors, especially when editing configuration files or code directly on servers.
Given Data / Assumptions:
Concept / Approach:
The r command in vi replaces the single character under the cursor with the next character you type. It does not enter insert mode; instead, it performs an in-place substitution and returns to normal mode instantly. This differs from commands like s (substitute one character and enter insert mode), S (change the entire line), and C (change from cursor to end of line).
Step-by-Step Solution:
Verification / Alternative check:
Compare with s: pressing s deletes the character and switches to insert mode, allowing multiple characters to be typed before pressing ESC. For a strict one-character swap without entering insert mode, r is correct.
Why Other Options Are Wrong:
Common Pitfalls:
Final Answer:
r.
Discussion & Comments