1. Switch to the next file
Suppose the file you want to switch to is named test.py
: Ex test.py
2. In-document copy command
Yy"The line where the cursor is copied. or uppercase one Y. 2yy"duplicate two lines. y^"Copy to the beginning of the line, or y0. Does not contain the character where the cursor is located. y$"Copy to end of line. Contains the character where the cursor is located. (Note the difference with y^)yw"Copy a word (word). y2w"copy two words (words). YG"Copy to the end of the file. y1g"copy to the top of the file. P"lowercase p, attached to the cursor (bottom). P"uppercase P, affixed to the front (top) of the cursor. Enter U to undo the previous step, CTRL +R can restore the undo of the previous step there is a good way to use the line number like to put 2-5 lines cut to 12 lines at a direct:2,5Move A
3. Inter-document Copy command
Need to copy to pasteboard a
The command in 2nd is appended with a double quotation mark and A, for example:
"Ayy" Copy a row
"a3yy " copy 3 lines "ap " pasted to the cursor (bottom)
4. Cancel Highlight Search
After using the find, want to cancel the highlight, I generally use two methods:
Use the command:
: Noh
or search for a string that doesn't exist.
5. Commonly used folding commands
" collapse from cursor to 12 rows ZD " " manual"" marker "is valid
6. Write code with VIM
VIM is a great editor for writing code because some of its features are designed specifically for programmers. Here are some of the commonly used:
]p: Similar to the function of P, but it automatically adjusts the indentation of the pasted text to fit the position of the current code. Try it! %: Match curly braces, brackets, brackets, and so on. At the top of a bracket, and then by%, the mouse appears in the other half of the matching brackets. >>: Indent All selected codes <<: Similar to above, but indent GD: reaches the definition of the function or variable where the cursor is located. K: In man, look for the word where the cursor is currently located.
Vim Operation notes