vi editor navigation: move forward to the end of the current/next word In the vi editor's normal mode, which single-key command moves the cursor forward to the end of a word?
-
Ac
-
Bd
-
Cb
-
De
-
ENone of the above
Answer
Correct Answer: e
Explanation
Introduction / Context:Efficient text editing in vi (and Vim) relies on motion commands. Learning single-key motions for word-wise navigation speeds up editing dramatically. This question focuses on the motion that moves the cursor forward to the end of a word.
Given Data / Assumptions:
- We are in vi normal mode (not insert mode).
- The goal is to move to the end of the current or next word.
- Default word boundaries are assumed (simple word definition).
Concept / Approach:
vi provides word motions: w moves to the beginning of the next word, b moves backward to the beginning of the previous word, and e moves forward to the end of the current or next word. These motions can be combined with operators like d (delete) and c (change) for powerful text manipulation (for example, de deletes to the end of the word).
Step-by-Step Solution:
Enter normal mode (press Esc if needed).Press e to move the cursor to the end of the current word; pressing e again advances to the end of the next word.Use counts to jump multiple words: 3e moves to the end of the third word forward.Combine with operators, for example, ce to change from the cursor to the end of the word.Verification / Alternative check:
Open any text in vi and try w, b, and e to feel the difference between beginning-of-word and end-of-word motions. Observe how punctuation and whitespace affect movement under default settings.
Why Other Options Are Wrong:
- c: begins a change operation; not a motion by itself for cursor movement.
- d: begins a delete operation; not a pure motion.
- b: moves backward to the beginning of the previous word, not forward to the end.
- None of the above: incorrect because e is correct.
Common Pitfalls:
Confusing e with w, forgetting to be in normal mode, or using motions without counts when large jumps are needed. Practice in normal mode to build muscle memory.
Final Answer:
e