Skip to main content
Engineering LibreTexts

05-A.2.1: Vim - Insert Mode

  • Page ID
    32119
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    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


    05-A.2.1: Vim - Insert Mode is shared under a CC BY-SA 4.0 license and was authored, remixed, and/or curated by LibreTexts.

    • Was this article helpful?