Difficulty: Easy
Correct Answer: nu
Explanation:
Introduction / Context:
When working in the UNIX vi editor, it is often helpful to display line numbers beside each line of text. This aids navigation, error reporting, and collaboration because commands like “:42” or “:1,10” become clearer when you can see the exact line indices. The vi/vim configuration uses the :set command to toggle editor options such as numbering, case sensitivity, and more.
Given Data / Assumptions:
Concept / Approach:
In classic vi, line numbers are enabled with the option named “number”. The short mnemonic for that option is “nu”. You can toggle it by entering command-line mode and typing :set nu to turn it on or :set nonu to turn it off. Vim additionally supports relative numbering (:set relativenumber), but the base, most universal option remains :set number (or :set nu).
Step-by-Step Solution:
Verification / Alternative check:
Use :set number to see the same effect using the full option name. Run :set? number to query the current state; vi/vim reports whether the option is set or not.
Why Other Options Are Wrong:
nm: not a valid vi option for numbering. ic: stands for “ignorecase” in searches, unrelated to numbering. li: not the standard numbering option. None of the above: incorrect because “nu” is correct.
Common Pitfalls:
Confusing “nu” with “relativenumber” in vim; forgetting to prefix with colon in command-line mode; expecting numbering without issuing :set or editing ~/.vimrc to enable it permanently.
Final Answer:
nu
Discussion & Comments