Vim common usage

Source: Internet
Author: User

Vim and VI usage are basically the same, Vim is more powerful, and there are color markers. Vim is used, VIM has three modes are general mode, edit mode, command mode.

    1. General mode: Delete, copy, and paste

      X: Remove Backward

      X: Delete Forward

      NX: Remove n characters backwards

      DD: Delete When line

      D: Delete When line character

      NDD: Deletes the current row down n rows

      YY: The line where the cursor is copied

      P: Pastes the copied data on the next line of the cursor

      P: Pastes the copied data on the previous line of the cursor

    2. Edit mode:

      I: Inserting a character at the cursor location

      I: Insert the input character in the first non-empty position on the line where the cursor is located

      A: Current cursor next position input character

      A: Enter a character at the last position of the line where the cursor is located

      O: Enter characters at the first position of the line where the cursor is located

      O: Enter characters at the top of the line where the cursor is located

      R: Replace the character where the cursor is located

      ESC: Exit Edit mode

    3. Command mode

      H: Move the cursor one character to the left

      J: Cursor moves down one character

      K: Move the cursor up one character

      L: Move the cursor right one character

      Ctrl+f: Screen down one page

      Ctrl+b: Screen up one page

      GG: First line of document

      G: Last line of document

      NG: Cursor moves to n rows

      /word: Finding word after the cursor

      ? Word: Find word before the cursor

      S/WORD1/WORD2/G: Current cursor line, word1 Replace with Word2

      N1,n2s/word1/word2/g:n1 line to N2 all Word1 replaced with Word2

      U: Fallback

      Q: Exit

      Q! : Forced exit

      WQ: Save and exit

      Set Nu: Display line number

Vim common usage

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.