Insert Mode: Edit File

Edit File

The most common way to edit the contents of a file is in Insert mode.

Open temp-file.txt

Enter Insert mode by typing i in Normal mode:


In Insert mode type your content:

vim: content being added while in Insert mode

While in Insert mode your keyboard presses are redirected to the contents of the file.

File Navigation in Insert Mode

While in Insert mode the cursor can be controlled with the directional arrow keys on your keyboard.

Try using the directional arrow keys to move your cursor over text. I will move the cursor after the period of the third paragraph:

vim: insert mode cursor moved to end of third paragraph

After navigating to the new position you enter more text at the location of the cursor:



Navigation is possible in Insert mode, but is cumbersome. Luckily there are more effective ways to navigate the file while in Normal mode. This will be covered in a future article.

Deleting Content in Insert Mode

While in vim Insert mode text can be deleted by using the backspace or delete keys. These keys behave the same way as they do in other text editors: