Advanced Text-Fu · Lesson 6 of 13

Vim Inserting and Appending Text

0 / 5 checkpoints answered

Full screen ↗

In Normal mode, Vim interprets keys as commands. Insert mode inserts typed text into the buffer. Several Normal-mode commands enter Insert mode at different positions, letting you begin typing without separate navigation.

Press Esc to leave Insert mode and return to Normal mode. If you are unsure which mode is active, pressing Esc is a safe way to reestablish Normal mode, although it can cancel a pending operation.

CheckWhich key normally returns from Insert mode to Normal mode?

Inserting before or after the Cursor

From Normal mode:

  • i: Enter Insert mode before the cursor.
  • a: Enter Insert mode after the cursor.

For example, if the cursor is on b in abc, i begins before b, while a begins after b. Both commands change modes; the text you type afterward performs the insertion.

CheckWhich Normal-mode key enters Insert mode immediately before the cursor?

Inserting at Line Boundaries

Uppercase commands target meaningful positions on the current line:

  • I: Enter Insert mode before the first nonblank character.
  • A: Enter Insert mode at the end of the line.

On an indented line, I skips indentation and begins before the first nonblank text. Use 0i if you specifically need to insert at column zero.

CheckWhich Normal-mode command begins insertion before the first nonblank character of the current line?

CheckWhich Normal-mode command moves to the end of the current line and enters Insert mode?

Opening a New Line

From Normal mode:

  • o: Open a new line below the current line and enter Insert mode.
  • O: Open a new line above the current line and enter Insert mode.

Vim applies indentation according to current settings and filetype rules. A count can repeat the open-line operation, but first learn the single-line form so the resulting cursor position is predictable.

CheckWhich Normal-mode command opens a new line above the current line and enters Insert mode?

To practice moving between Normal and Insert modes, try this hands-on lab:

  1. Edit Text Files in Linux with Vim and Nano - Practice creating files, editing text, saving files, and navigating with both vi/vim and nano. This lab will help you master the fundamental skills of using Vim's Normal and Insert modes.

Summary

You can now enter Insert mode at the position where new text belongs.

  1. Return to Normal mode with Esc.
  2. Insert before or after the cursor with i or a.
  3. Insert at the first text or line end with I or A.
  4. Open a line below with o.
  5. Open a line above with O.