1. Mode Description:
Before you can really start using VIM, you must first understand the vim pattern, otherwise you may be unprepared for vim. Vim is a modal
Editor, which means that VIM has a number of different modes of operation, and the same actions of users in different working modes will result in different results. Imagine
On your phone, when your phone is in standby (Sleep mode), press the power button to wake the phone when your phone is active
State (active mode), the Power key is pressed into standby. Vim extends your keyboard through the pattern, equivalent to the usage pattern
Make your phone's power key function extend the same. Vim does this to help you edit your text more efficiently.
The main modes of VIM are:
s) Normalmode: Literal translation of the regular pattern, but I prefer to call it "orchestration mode". Vim is normal when it is started
mode, in which your action is to command vim to help you complete an action, for example, when you are on the keyboard
Clicking the "H" button is equivalent to pressing the arrow key "<-" and moving the cursor one character to the left. In normal Mode
, your more action is to modify the document, so I prefer to call it orchestration mode.
2) Insertmode: Literally translates the insert pattern, but I prefer to call it "writing mode". In this mode, you press the "H" key,
That is, the "H" character is entered, and we use Notepad to edit the text is not very different, this is called "the key is obtained" ^^. When
When in insert mode, VIM displays
3) Visualmode: literally translated into visual mode, in fact I prefer to call it "block operation Mode", because in this mode, you
Always select an area first and then perform some action, which can be considered as the local normal mode.
When you enter visual mode, VIM displays
2. Switching between modes
Normal mode switches to Insert mode:
I: Enter insert mode and let the cursor precede the current character
I: Enter insert mode, and the cursor is in front of the first non-null character in the current line
A: Enters insert mode, and the cursor is behind the current character
A: Enter insert mode, and the cursor is at the end of the current line
O: Enter insert mode and a new line after the current line with the cursor in the new row
O: Enter insert mode and insert a new row at the top of the current line with the cursor in the new row
S: Delete the current character and enter insert mode
S: Delete the current line and go to insert mode
Insert mode switches to normal mode:<ESC> keys
Normal mode switches to Visual mode:
V: Enter visual mode, select in characters
V: Enter visual mode, select the unit of behavior
Visual mode switches to normal mode:<ESC> keys
Diagram converted for each mode:
The mode of VIM