nerdexam
CompTIA

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.

GNU and Unix Commands

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)
  • A
    3% (1)
  • B
    87% (26)
  • C
    3% (1)
  • D
    7% (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.

Ai (interactive) requires the user to explicitly switch between vi modes whereas a (automatic)

Vi always requires the user to switch modes explicitly; there is no 'automatic' mode - this description is entirely fabricated.

Bi (insert) inserts text before the current cursor position whereas a (append) inserts text after theCorrect

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.

Ci (independent rows) starts every new line at the first character whereas a (aligned rows) keeps

Neither 'i' nor 'a' controls indentation alignment or row starting position; that behavior is unrelated to these commands.

Di (interrupt) temporarily suspends editing of a file to the background whereas a (abort) terminates

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

#vi editor#insert mode#append command#cursor positioning

Community Discussion

No community discussion yet for this question.

Full LX0-103 Practice