VI is the Unix operating system and Unix operating system is the most common text editor.
VIM editor is developed from a more powerful VI text editor. The initiative will be designed to font color syntax correctness, convenient program. VIM is fully compatible with the VI editor.
General mode
Vi to open a file directly into the general pattern of the (this is the default mode). In this mode, you can use the arrow keys to move the cursor, you can use the Delete character or delete the entire line to process the contents of the file, you can also use copy and paste to handle your data files.
Table 1-1 Common Grammar
grammar |
Functional Description |
yy |
Copy the current cursor line |
y Digital y |
Copy the period (from a few lines to a few lines) |
p |
Line arrow to the object pasted |
in |
Undo the last step |
dd |
Delete the current cursor row |
d Digital d |
How many lines after the cursor is deleted (including) |
x |
To delete a letter, equivalent to del , back deleted |
X |
To delete a letter, equivalent to Backspace , delete forward |
is |
Copy a word |
dw |
To delete a word |
shift+^ |
To move the line head |
shift+$ |
Move to the end of the line |
gg or 1 + G |
Move to header |
G |
Move to footer |
Digital + G (first input number, press G ) |
Move to the goal line |
Edit mode
Can delete, copy, paste and other movements in the general mode, but you can not edit the contents of the file! You will enter the edit mode until you press any letter i I o O a A and the like.
Note that, generally in Linux, these buttons are pressed, or word REPLACE INSERT occur in the left corner of the screen, this time can be edited. And if you want to be halfway through mode, you have to press the Esc key to exit edit mode.
1 . Enter edit mode
Table 1-2 Common Grammar
button |
Features |
i |
Before the current cursor |
a |
The current cursor |
The |
The next line of the current cursor row |
I |
Cursor line foremost |
A |
The last line where the cursor |
THE |
On the current line of the cursor line |
2 . Exit edit mode
Press the " Esc " key
Command mode
Among the general pattern, type: / 3 in any of the buttons, you can move the cursor to the line under the most?.
In this mode, you can provide information on the search operation, and read, save, replace a large number of characters, leave vi, display line numbers such action is achieved in this mode!
Table 1-3
command |
Features |
:w |
Storage |
:q |
drop out |
:! |
Enforcement |
/ To find the word |
n Find Next, N up to find |
? To find the word |
n is a lookup on, N is the look down |
: Not set |
Show Line Numbers |
:set nonu |
Close line number |
ZZ(shift+zz) |
Do not modify the file directly exit, if you modify a file save and exit |