Introduction to Vim
- Yum install-y vim-enhanced installation package
- Vim is an upgraded version of VI
- Vim is color-displayed
- Sub-general mode, edit mode, command mode
Vim color display and move cursor in general mode
- The same file appears differently in different directories, and the display color is also related to the file name (suffix) and content
- H moves to the left, L moves to the right, K moves upward, J moves down, space moves to the right, supports numbers and letters move multiple characters
- Ctrl+f or PageUp screen moves forward one screen, ctrl+b or pagedown screen moves backwards one screen
- The number 0 or shift+6 moves to the beginning of the line, Shift+4 moves to the end of the bank, GG moves to the first line, G moves to the tail line, and NG (n is any number) moves to the nth row
Copy and paste in general mode
- X means to remove one character backwards and X to delete one character forward
- NX removes n characters backwards
- DD Delete/Cut the line where the cursor is located
- NDD (n is number abbreviation) Delete/cut n rows after the line where the cursor is located
- YY the copy cursor is in the row
- P paste the copied or pasted content from the line where the cursor is located
- P from the line where the cursor is located, paste the contents that have been copied or pasted up
- Nyy starts at the line where the cursor is located, copying the n rows down
- U Restore previous action
- V Press V to move the cursor will select the specified character, and then can be copied and pasted and other operations
Vim General mode