Skip to main content
Engineering LibreTexts

05-A.2.1: Vim - Insert Mode

  • Page ID
    32119
  • Insert Mode

    In insert mode you can type new text. In classic vi the insert mode was just that: insert text and nothing else. Vim makes use of many meta keys on modern keyboards; with a correctly configured vim, cursor keys should work in insert mode.

    Insert mode can be reached in several ways, but some of the most common ones are as simple as entering a keystroke:

    • i – New text will appear before the cursor.
    • a – New text will appear after the cursor.
    • I – New text will appear at the beginning of the current line - cursor is moved to the beginning of the current line.
    • A – Next text will appear at the end of the current line - cursor is moved to the end of the current line.
    • o – A new line is created after the current line - cursor is placed at the beginning of the new line
    • O – A new line is created before the current line - cursor is placed at the beginning of the new line

    You can enter any text you desire. Be aware that, by default, there is no autowrap - vim will let you enter as long as you keep typing. There is a configuration setting that will help you with this, but we do not cover that in this course.

    Your arrow keys are usable while in insert mode.

    To exit insert mode, simply hit the ESC key.

    As always you can exit the editor by making sure you are in command mode, hitting the ESC key, then entering :wq (which writes, then quits), or :q! which will quit without saving your changes.

    Adapted from:
    ""Learning the vi Editor/Vim/Modes" by Multiple contributors, WikiBooks is licensed under CC BY-SA 3.0

    • Was this article helpful?