5.1-5.4
Vim and VI are almost the same, the only difference is that when editing a text, using VI will not show the color, and using VIM will show the color.
VIM has three modes: General mode, edit mode, command mode.
When the system is minimized, the VIM command is not installed and you need to install it yourself using Yum:
[email protected] ~]# Yum install-y vim-enhanced
Version view Vim version of the current system
Move the cursor in general mode
Add:
SPACEBAR: Move right one character number ' 0 ' and shift+6: Move the cursor to the beginning of the line
SHIFT+4: Moves the cursor to the end of the line
Cut, copy, paste in normal mode
Enter edit mode
Return general mode "ESC" from edit mode
Command mode
The difference between ": Wq" and ": X"
": Wq" Mandatory write file and exit (save and exit write and quite). Force write even if the file is not modified, and update the file's modification time.
": X" writes the file and exits. Writes only when the file is modified and updates the file modification time, otherwise the file modification time is not updated.
Difference:
The two are generally not the same, but in terms of programming, editing the source file can have a significant impact. Because the file is not modified, ": Wq" forces the update of the file's modification time so that make compiles the entire project with the file being modified, and then the recompile link is delivered to the executable file. This can have misleading consequences and, of course, unnecessary system resource costs. But like version control software generally preferred or compare file content, modification time is generally ignored.
Several shortcut keys commonly used in VIM
Note All lines: Ctrl + V j/k+ shift +i
View cursor the current man manual shift+k
d+f+ characters
Check area v+t+ characters
Remove all characters after the cursor in VIM shift+d
Delete the word on the current cursor d+i+w
Select the word on the current cursor v+i+w
5.1-5.4 vim shortcut keys