SoFunction
Updated on 2025-03-10

A brief discussion on the four modes and mode switching of vim

vim is different from Notepad or WORD. It is not possible to enter text after opening it. At this time, it is in normal mode.

There are 4 modes in vim:

• Normal-mode

• Insert-mode

• Command-mode

• Visual-mode

Normal mode

After starting vim, it is in normal mode by default. No matter what mode you are in, pressing the <Esc> key (sometimes you need to press twice) will enter the normal mode.


Insert mode

Pressing i, I, a, A and other keys in normal mode will enter the insertion mode. Now just remember that pressing the i key will perform the insertion mode. In insert mode, the corresponding characters are written when the key is pressed.


Command Mode

In normal mode, press the: (English colon) key and enter command mode. In command mode, you can execute some input and execute some instructions provided by vim or plug-in, just like in a shell. These instructions include setting the environment, file operations, calling a certain function, etc.


Commonly used commands are: q (exit), q! (forced exit), w (save), wq (save and exit).

Visual mode

Press v, V, <Ctrl>+v in normal mode to enter visual mode. The operation in visual mode is a bit like using a mouse to operate. When selecting text, there is a sense of visualization like mouse selection, which is sometimes very convenient.

The above article briefly discusses the four modes and mode switching of vim are all the content I share with you. I hope you can give you a reference and I hope you can support me more.