Patricia Sauer - Authentic Programming

About the modi in vi

a light switch

A situation, every vi beginner faces. You opened a file in vi, start typing but your text does not appear on the screen. In the best case, you hear beeps and see some strange things in the status line at the bottom. So let's learn which modi exist in vi and how to switch between them.

Command mode

After opening vi, you are in command mode. Command mode means that vi will take your input as a command, e.g. you could enter insert mode, navigate within a file, save a file, or exit vi. When you are in insert mode, you can switch to command mode by typing ESC.

Insert mode

In insert mode, whatever you type will appear in your file. You can enter insert mode by pressing i when being in command mode. You can leave insert mode bye pressing ESC aka switching back to command mode.

Recap

In this article we learned that

  • there are two modi in vi: command mode and insert mode
  • command mode is the default mode after opening vi
  • command mode interprets your input as commands like entering insert mode, navigating in a file, saving a file, or exiting vi
  • insert mode will take your input as input and add it to the current file
  • insert mode can be entered by pressing i
  • you can switch back to command mode by typing ESC

Watch it on YouTube

You can watch me explaining the different modi in vi and vim in this video:

Liked this article?

Buy Me A Coffee

© 2018 - 2024 Patricia Sauer