Vim's shortcut keys

Source: Internet
Author: User

Vim's shortcut keys

(0) 3 The toggle between modes is default in command mode. I key, from command mode, into insert mode. The colon (:) key, from the command mode, enters the last line mode. Esc key, from insert mode, last line mode, into command mode.

(a) The command mode Vim shortcut keys (commonly used) 1, move the cursor GG: The cursor moves the file at the beginning G: The cursor moves to the end of the file 12G: Move to the specified line, line number g (Extension: Jump to the specified line when opening a file, vi file name + number of lines) ^: The cursor moves to the beginning of $: Cursor moves at the end of the line. Ctr-f: Turn down one screen ctr-b: Turn up a screen 2, Undo command: U: Step by step undo the Ctr-r: Anti-undo 3, Delete command: x: Delete the cursor after a character, equivalent to DELX: Delete the previous character of the cursor, equivalent to Backspacedd: Delete (also cut) cursor is located Row, NDD deletes the specified number of rows. D0: Delete to the beginning of the line (the second character is 0) d$: or uppercase D, delete to the end of the row DW: Remove one word (word) DB: Delete one word forward DG: Delete from the current location to the end of the file DGG: Delete from the current location to the beginning of the file 4, copy paste: yy: Copy Current line (10yy copy 10 lines) p: A new line at the cursor position, paste P: Up a new line at the cursor position, paste 5, replace the operation: R: Replace the current character R: Replace the current line cursor after the character 6, Text line movement: Used to control indentation >>: Text line Right Shift < <: Text line move left 7, repeat command: Point (.) Repeat command 8, visual mode: With the arrow keys used to select text V: move by character, select text V: move by line, select the text visual mode can match D, y, >>, << Implement the deletion of the text block, copy, move left and right 9, Command mode find command:/str   (such as  /keyword in VI text, look for a word or string named keyword. N: Next N: Previous (second) Insert mode shortcut key (Common) I: Insert cursor before one character I: Insert line  a: Insert Row not o: New line down, insert beginning O: New line up, insert beginning CW: Delete one word backward and enter insert mode. CB: Deletes a word forward and enters insert mode. Ctrl+u: Deletes all the contents of the previous line of the cursor. (iii) shortcut keys for last-line mode (common) exit and Save: q! Exit does not save: W Save: Wq Save and exit or in command mode: Uppercase zz  is also exit and save   Summary: 1, do not save and exit ① if the user is not want to save the modified file and to forcibly quit VI, you can use the command: q! VI Discard the changes and return directly to the shell. 2. Save and exit ① in the last line modeType, enter command: WQVI will save the file first, then Exit VI to return to the shell. ② in last-line mode, enter command: X③ the command function is the same as the ZZ command in command mode. Execute shell command in  vim: Enter in the last line mode! Temporary access to the terminal, followed by commands such as::!  ls -LH Replace command::%s/original content/replace new content/g For example: replace all ABC with 123 in the last line mode, Replaces all ABC in the current file with 123. If G is not used, only the first ABC of each row is replaced with the specified line:%s/abc/123/g in the last row mode, the ABC between the first row and the 10th row is replaced with 123:1, 10s/abc/123/g

Shortcut keys for vim

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.