1. Vim operation command 1) Vim automatic directory completion
In the vim editing status (that is, the insert status), press Ctrl + X, and then press Ctrl + F to enter the directory auto-completion mode, which will be based on the directory in the text, show all files in this directory, select by the up and down keys, and press enter to confirm.
2) file comparison
Vimdiff file1 file2
CompareCodeDifference or text difference
Vimdiff has several convenient shortcut keys
<1> file redirection
Fast movement between different points
Skip to next
The right brace contains the letter C, that is, "] C"
Reverse jump
The left half is enclosed in brackets with the letter C, that is, "[C"
You can also add a number at the beginning to skip the number of difference points.
For example, "2 [C" indicates skipping the next difference and jumping to the second difference.
<2> file Merging
DP (diff "put") copies the content of the current file to another file
Do (diff "get") copies the content of another file to the current row.
<3> Redirection between two file windows
Use the shortcut key Ctrl + W
3) Vim background execution
In terminal, a file is opened with vim, but you want to view the content of another file but do not want to save it and exit. What should you do?
You can use the background execution function of vim.
Use Vim to open the file1 file, press Ctrl + Z to run file1 in the background, use Vim to open the file2 file, and run the job command to viewProgram(The first [N] indicates the number of execution in each background.) To return to the previously opened file1, you only need FG + N. For example, if the number of execution in the file1 background is 1, therefore, you only need to run command FG 1 to switch Vim file1 executed in the background to the foreground for execution.