Starting from command mode in vi, which THREE keys switch the editor into insert mode?
LPIC-1 Exam 101-500, objective 103. GNU and Unix commands easy
Draft — not checked yet. This question was written from the published exam objectives and cites the clause it comes from, but nobody has yet read it against that clause and signed for it.
It is kept out of search results and out of mock exams until they have. Read the source below before you take the answer as settled.
The options
Choose 3.
Correct i
Correct. i begins inserting text before the cursor position.
Not correct x
Wrong. x deletes the character under the cursor and leaves you in command mode.
Correct a
Correct. a appends, that is it begins inserting after the character under the cursor.
Correct o
Correct. o opens a new empty line below the current one and starts insert mode there (O opens one above).
Not correct :w
Wrong. The colon takes you to ex command mode, and w writes the buffer to disk. No text insertion is involved.
Why
i, a and o (plus their uppercase forms I, A and O) all enter insert mode, differing only in where the cursor lands: before the cursor, after it, or on a new line below. Esc always returns you to command mode, which is the key to press whenever you are unsure where you are.
Where this comes from
- Cited
- LPI exam objective 103.8
- What it says
- Enter and leave vi's insert mode.
Practise this
Reading one question is not practice. The trainer will draw a set from objective 103 and space the ones you get wrong.