Normal, Insert and Visual Mode
Vim has three different modes. 1) Normal mode, 2) Insert mode, 3) Visual mode.
Normal mode
In this mode, you cannot add text; however, you can do many things like
- Move the cursor around a document
- Delete text
- Copy and paste text
- Undo the previous action
- Search phrase
- Replace phrase
- Save file
- Exit (quit) Vim
Normal mode is sometimes called Command mode, especially after pressing :. When you press the : key on your keyboard, the :
letter shows in the bottom left corner of the screen. You can run some commands e.g., replace words, save file, exit Vim. By pressing the esc key, you can stop Command mode.
Insert mode
By pressing the i key on your keyboard, Vim changes to Insert mode, in which you can add text. You can launch the Insert mode with other letters such as I, a, A, o, and O; however, the cursor position is different when you launch the Insert mode. By pressing the esc key, you can move back to Normal mode.
Visual mode
By pressing the v key on your keyboard, Vim changes to Visual mode, in which you can select text as a block. You can launch Visual mode with the V key. When you use the v key, you can select text by word block. When you use the V key, you can select text by line. In this mode, you can delete, copy, and modify the selected block of text.