Follow the great God vim--------level Two

Source: Internet
Author: User

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:

  1. 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
  2. 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
  3. copy/paste
    • p   → Paste
    • yy   → copy current line of business in   ddP
  4. Undo/redo
    • u →undo----------commonly used very
    • <C-r> →redo
  5. 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.