LFCS · Question #795
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 the vi editor, i inserts text before the current cursor position, while a inserts text after the current cursor position.
Question
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
(44 responses)- A2% (1)
- B91% (40)
- C5% (2)
- D2% (1)
Why each option
In the `vi` editor, `i` inserts text before the current cursor position, while `a` inserts text after the current cursor position.
The terms 'interactive' and 'automatic' are not the correct meanings for `i` and `a` in `vi` modes, as both initiate insert mode.
The `i` command (insert) switches to insert mode, allowing text entry directly before the character under the cursor. The `a` command (append) also switches to insert mode, but places the cursor and allows text entry immediately after the character under the cursor.
The commands `i` and `a` do not control how new lines are indented or aligned; their function is to define the point of text insertion relative to the cursor.
Suspending or aborting file editing involves other `vi` commands or shell job control features, not `i` or `a`.
Concept tested: vi editor insert/append commands
Source: https://man7.org/linux/man-pages/man1/vim.1.html
Topics
Community Discussion
No community discussion yet for this question.