Vim is the legendary sword without front, big Qiao not work. Use good seconds to kill a large help IDE, with bad, hurriedly to learn.
First, take a picture, as a desktop background (basic not how to look, worry Mulberry: ()
After some basic commands, you can only survive, now it's time to learn some more commands, a cow's advice:
- various insertion modes
- a   → insert after cursor
- o → Insert a new line after the current line----This is particularly useful
- O → insert a new line before the current line
- CW   → Replace the character from the position of the cursor to the end of a word
- a simple move cursor
- 0 → Digital zero,------especially useful for your wardrobe
- ^ → to the first position of the bank that is not the blank character (so-called blank character is space, tab, line break, carriage return, etc.)
- $ → to the end of the bank---------This super fried chicken is often used, very cool, cool burst.
- G_ → to the last position of the bank that is not a blank character.
- /pattern → search for pattern strings-------Common
- copy/paste
- p → Paste
- yy → copy current line of business in   ddP
- Undo/redo
- u →undo----------commonly used very
- <C-r> →redo
- Open/Save/exit/change Files(Buffer)
- : E <path/to/file> → Open a file with not much
- : Wq → Save, exit
- : SaveAs <path/to/file> → Save As <path/to/file>
- : x, ZZ or : Wq → Save and exit (: x means save only when needed, ZZ does not need to enter a colon and return)
- : q! → Exit does not save : qa! forcibly exits all files being edited, even if other files have changed.
- : Bn and : bp → You can open many files at the same time, use these two commands to switch to the next or previous file.
take the time to familiarize yourself with the above commands, and once you've mastered them, you can almost do what other editors are capable of. But until now, you still think it's a bit awkward to use vim, but it doesn't matter, you can step to the next level.
Multi-line Comments:
1. Enter command-line mode, press CTRL + V to enter Visual block mode, then press J, or K to select multiple lines to mark the lines that need comment
2. Press the capital letter I, then insert the comment, for example//
3. Press the ESC key to annotate all
To cancel multiple lines of comment:
1. Enter command line mode, press CTRL + V to enter Visual block mode, select the number of columns by letter L, for example//2 columns to be selected
2. Select the comment symbol by the letter J, or K
3. Press the D key to cancel all comments
in the process of using VIM, copying the code in the terminal that is opened with SSH, often appears the situation of the format confusion, the solution is as follows:run the following command to enter paste mode:: Set PasteEnter paste mode, press I key into the insert mode, and then shift+ins to paste, the text format will not be garbled. after pasting is finished, you want to end the paste mode to perform:: Set Nopastein the process of using VIM, copying the code in the terminal that is opened with SSH, often appears the situation of the format confusion, the solution is as follows:run the following command to enter paste mode:: Set PasteEnter paste mode, press I key into the insert mode, and then shift+ins to paste, the text format will not be garbled. after pasting is finished, you want to end the paste mode to perform:: Set Nopaste
jump to a line::
Follow the great God vim--------level Two