Vim is a text editing tool under the Linux operating system. It is an upgraded version of VI. Unlike VI, when you open a file with Vim, the character color is clearly displayed. The default system does not have vim tools and can be installed via the Yum install-y vim-enhanced command. Its configuration file is/ETC/VIMRC. Users under the same self-configuration file, such as the root of the vim configuration file is/ROOT/.VIMRC. By default, this user profile does not exist and needs to be created manually.
When you open a file with the Vim tool, it is divided into three modes, such as General mode, edit mode and command mode. In general mode, you can perform quick move cursors, delete, cut, copy, and paste. In edit mode, you can quickly modify the contents of a file. In the command mode, the file can be command control to find, display line number, save exit and other operations. In general, when you manipulate a file, you need to handle it back and forth in three different modes.
One, the general mode of moving the cursor
Keys |
Role |
h or LEFT ARROW key |
The cursor moves one character to the left |
L or right ARROW keys. |
The cursor moves one character to the right |
K or Upward direction key |
Move the cursor up one character |
J or DOWN ARROW keys |
Move the cursor down one character |
Ctrl+f or PageUp key |
The screen moves forward one page |
Ctrl+b or PageDown key |
The screen moves backward one page |
Number 0 or Shift+6 |
Move to the beginning of the bank |
Shift+4 |
Move to the end of our line |
Gg |
Move to First line |
G
|
Move to Tail line |
NG |
Move to Nth row |
Second, the general mode of copy and paste
Keys |
Role |
X,x |
X means to remove one character backwards and X to delete one character forward |
Nx |
Remove n characters backwards |
Dd |
Delete/Cut the row where the cursor is located |
Ndd |
Delete/cut n rows after the row of the cursor |
Yy |
The copy cursor is in the row |
P |
From the line where the cursor is located, paste the contents that have been copied or pasted down |
P |
From the line where the cursor is located, paste the contents that have been copied or pasted up |
Nyy |
Copy n rows down from the line where the cursor is located |
U |
Revert back action |
V |
Moving the cursor after pressing v selects the specified character and can then perform operations such as copy and paste |
This article is from the "garbled Age" blog, please be sure to keep this source http://juispan.blog.51cto.com/943137/1940335
[CentOS 7 Series] Vim General mode