Editing and Saving Files with vi

vi operates in one of two modes. vi behaves differently, depending on which mode it's in:

  • Normal mode: The characters you type are editing commands that perform operations on your file, such as moving the cursor, deleting a character or a line, etc. There are two types of commands:

    • Keys sequences: Pressing keys issues commands to vi. For instance, pressing x deletes the character after the cursor.

    • Command line: Pressing a semicolon allows you to type commands with arguments. The cursor moves to the bottom of the screen, waiting for you to type a command.

  • Insert mode: When you type keys, the characters are inserted into the file. Typing certain commands, such as i (the insert command), puts vi into Insert mode. ...

Get Spring Into Linux® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.