Vim Common operation

Source: Internet
Author: User

Reference https://www.fprintf.net/vimCheatSheet.html

1. Exit Operation:

: Q Exits when the contents of the file are not changed, and exits if there is a change in content

: q! Force quit does not save

: CQ forced exit does not save

: Wq Save and exit

: wq! Force Save exit

: Wq {file name} saved and exited when no changes were made to the file

: wq! {file name} No matter if the file is modified, force Save as another file and exit without modifying the original file

[range]wq[!] Save only the data in the range other data deleted usage is as follows:

If there is a file with the following contents:

A

B

C

D

E

So: 3,5 wq! To save only 3 to 5 rows c,d,e This three data, the range is separated by a comma between the starting and ending values to indicate that only one row is saved if there is no comma, this way wq to add!

Otherwise it will fail.

ZZ: Equivalent to wq!

ZQ: Equivalent to q!

2. Edit the file:

: E If the file is edited outside of Vim, the current file is re-edited

: e! Erase previous changes, re-modify the current file

: e {File} edits the specified file

: e! {file} ignores previous modifications, edits the specified file

GF Edit file name under cursor

3. Input operation

A ENTER after the cursor

End of A Line input

I enter before the cursor

I input before the first non-blank

GG: Jump to the first column

o Another line of editing under the cursor

O another line of editing on the cursor

4. Inserting files

: R [Name] inserts the contents of a file after the cursor

: r! {cmd} executes the cmd command, then inserts the output of CMD after the cursor

5. Delete Files

X: Delete the contents after the cursor

X: Delete the content before the cursor

6. Revocation

U: Undo Changes

: U undo a change

CTRL R: Redo All

: Red Redo an undo content

7. Encryption

: x (uppercase X) simple encryption operation, if you are not careful to this and do not want to encrypt, just two times directly return instead of entering the password

Vim Common operation

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.