LX0-103 · Question #195
What is the difference between the i and a commands of the vi editor?
The correct answer is B. i (insert) inserts text before the current cursor position whereas a (append) inserts text after the. In vi, 'i' and 'a' both switch to insert mode, but differ in cursor position: 'i' inserts text before the cursor while 'a' appends text after it.
Question
What is the difference between the i and a commands of the vi editor?
Options
- Ai (interactive) requires the user to explicitly switch between vi modes whereas a (automatic)
- Bi (insert) inserts text before the current cursor position whereas a (append) inserts text after the
- Ci (independent rows) starts every new line at the first character whereas a (aligned rows) keeps
- Di (interrupt) temporarily suspends editing of a file to the background whereas a (abort) terminates
How the community answered
(30 responses)- A3% (1)
- B87% (26)
- C3% (1)
- D7% (2)
Why each option
In vi, 'i' and 'a' both switch to insert mode, but differ in cursor position: 'i' inserts text before the cursor while 'a' appends text after it.
Vi always requires the user to switch modes explicitly; there is no 'automatic' mode - this description is entirely fabricated.
The 'i' command (insert) places the editor into insert mode and accepts new text immediately before the current cursor position. The 'a' command (append) enters insert mode and accepts new text immediately after the current cursor position, which is useful for adding characters to the end of a word or line without repositioning first.
Neither 'i' nor 'a' controls indentation alignment or row starting position; that behavior is unrelated to these commands.
Neither 'i' nor 'a' suspends or terminates editing; Ctrl+Z suspends and ':q!' aborts in vi.
Concept tested: vi editor insert vs append mode commands
Source: https://ex-vi.sourceforge.net/viin/node5.html
Topics
Community Discussion
No community discussion yet for this question.