Vim program editor
1. first introduce the VI Editor
VI is divided into three modes: general mode, edit mode, and command line mode.
Open the file and enter the normal mode.
When you press any letter of "I, I, O, O, a, a, R, R, press [ESC ].
In normal mode, enter ":,/,?". You can enter the command line mode.
2. Vim key description
Summary of Common commands:
Move cursor: 0: Move to the front character of this line
$: Move to the end of the line
NG: Row N of the file to be moved.
1G: Move to the first line of the file
Search:/word: Search down for a string named word ,? Word: search up for a string named Word
N: Repeat the previous search action N: Reverse Lookup
Replace: N1, N2s/word1/word2/g to find word1 between line N1 and line N2 and replace it with word2
: N1, N2s/word1/word2/GC searches for word1 between line N1 and line N2, replaces it with word2, and asks whether to replace
Delete: DD: Delete the entire row where the cursor is located.
NDD: delete n rows down the cursor
Copy YY: copy the row where the cursor is located
Nyy: copy the N rows down the cursor
Paste P: paste the copied data to the next row of the cursor P: paste the previous row of the copied data cursor
Other J: Combine the row where the cursor is located with the next row into the same row
U: Restore the previous operation
[CTRL] + R: Repeat the previous operation
Save the file of VIM, restore and enable warning information
At present, the main editing software will have the "recovery" function. Even if it causes similar crashes for some reason, you can use a special mechanism to save the previously unsaved data.
When we edit vim, VIM creates a file named. filename. SWP in the directory of the edited file. Therefore, the edited unsaved file content will be saved in this
File.
Vim Block Selection Function
V character selection
Select row v
[CTRL] + V Block Selection
Y copies the anti-whitelist.
D. Delete the whitelist.
At the same time, VIM also provides multi-file editing functions. Of course, you can switch between multiple windows in a cool way.
About Vim environment setting parameters
Important Review