The most commonly used key description for the VIM editor

Source: Internet
Author: User
Tags save file

n represents a number, words represents a string

1. Set line number: input: Set Nu

2. Jump to a line: Enter NG. First line 1G, tail line g

3. Delete successive n rows: Skip to the row you want to delete, then enter: NDD

4. Delete successive characters of a row: jump to a line first, then enter: NX; NX removes the N characters consecutively.

5, continuous down copy n rows: First jump to a line that needs to be copied, and then enter: Nyy

6. Paste the N line down: First jump to the row you want to paste, enter p, indicating that the next line of the cursor begins to paste, and the input p indicates that the previous line of the cursor begins pasting.

7. Enter characters manually: Jump to a line that you want to enter, and then enter O to insert a new line at the top of the cursor, and enter an o to begin inserting a row on the next line of the cursor.

8. Find a string: Enter:/words to find this string; Words indicates that this string is looked up.

9. Save File: Enter: W path name/file name.

10. Save and exit: Input: QW

11, do not save exit: input: q!

12, Block Selection (visual block): Press CTRL + V, select a column or columns that need to be copied, selected in the anti-white state, press Y to copy, in the input mode, move the cursor to the place where you want to paste, in command mode, press paste.

13. Open multiple Files: VI file1 file2 ... Input:: Files view the number and file of the edited file; in one file, enter:: N Select another file to edit

14. Switch between multiple files: input: N (where n does not represent a number).

15. View multiple file names and numbers: input: Files

16, the File Multi-window operation: First VI open a file, and then enter: SP (without file name in the back to continue to open a copy of the current file) or: SP filename (open another file); ctrl+w switch between files.

17. Page Turning: Turn the screen with Ctrl+f to the end of the file, and flip the screen to the file header with Ctrl+b.

18, jump to the beginning of the line with: 0; jump to the end: $

19. Global substitution:%s/source string/destination string/g

20, using the command set IC or set Noic to define whether the lookup is case-sensitive or case-insensitive, the default is case-sensitive.

21, D0 the current cursor is deleted to the beginning of theline; d$ the current cursor is deleted to the end.

The most commonly used key description for the VIM editor

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.