Summary of common vim usage

Source: Internet
Author: User

Summary of common vim usage
Vim is basically the same as vi in usage. vim is more powerful and has color labels. Vim has three modes: general mode, edit mode, and command mode. Normal Mode: delete, copy, and paste x: delete backward X: delete forward nx: delete n characters dd: delete when Row D: delete when row ndd: delete n rows down the current row yy: copy the row where the cursor is located p: paste the copied data to the next row P of the cursor: paste the copied data to the top row of the cursor editing mode: I: insert character I at the position of the cursor: insert the input character a at the first non-empty position of the row where the cursor is located: enter character A at the next position of the current cursor: Enter character o at the last position of the cursor row: Enter character O at the first position of the next line of the cursor row: enter the character r: Replace the character esc: Exit edit mode command mode h: move the cursor to the left one character j: move the cursor down one character k: move the cursor up one character l: move the cursor right one character ctrl + f: Turn the screen down one page ctrl + B: Turn the screen up one page gg: the first line of the document G: the last line of the document nG: move the cursor to n rows/word: Search for word after the cursor? Word: Search for word s/word1/word2/g before the cursor: the row where the current cursor is located. Replace word1 with word2 n1, n2s/word1/word2/g: replace all word1 from line n1 to line n2 with word2 u: Roll Back q: Quit q!: Force exit wq: Save and exit set nu: Display row number

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.