A figure helps you remember the vim commands of linux (let's watch them out)

Source: Internet
Author: User
In linux, vim is quite powerful. at the beginning, everyone who is familiar with it will feel useful but cannot remember what it is for. now let's take a look at the basic commands. (There is no time for today. add some examples in the search time) search: word search down to word? Word direction

In linux, vim is quite powerful. at the beginning, everyone who is familiar with it will feel useful but cannot remember what it is for. now let's take a look at the basic commands.

(We have no time today. please add some examples in time)

Search:
/Word search for word
? Word search up
N repeat the search string
N repeat the preceding string
: N1, n2s/word1/word2/g Replace word1 with word2 from line n1 to line n2
: N1, n2s/word1/word2/gc Replace word1 with word2 from line n1 to line n2 for confirmation.
: 1, $ s/word1/word2/gc Replace word1 with word2 from Line 1 to the last line for confirmation.

Copy and paste:
Yy copy the row where the cursor is located
Nyy copies the next n rows of the cursor
Y1G copy all
YG copy all cursor
Y0: Copy the cursor to the beginning of the line
Y $ copy the cursor to the end of the row

Delete:
X, X delete a character backward/forward
Nx deletes n consecutive characters backward
Dd deletes the row.
Ndd delete n rows
D1G delete all
DG delete the cursor to the end
D0 delete cursor to first line
D $ delete the cursor to the end of the row

Operation:
J. Combine the row where the cursor is located with the data of the next row into the same row
U recover the previous operation (equivalent to undo)
[Ctrl + r] redo the previous operation
. Redo the previous operation.
Command
:! Command

Summary:
Starting from 1 GB
Lowercase letters, capital letters, forward, and backward

Multi-file editing
Vim filename1 filename2
: Files
N switch to another file


Multiple windows
: Sp [filename]

This figure is painted by laruence. you can refer to it for reference (from laruence's linux private House dish)

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.