Common Vim commands (which can be used as TXT files for reference)

Source: Internet
Author: User

[CTRL] + [f] the screen moves one page down, which is equivalent to a [Page Down] button (commonly used)
[CTRL] + [B] The screen moves one page up, which is equivalent to a [page up] button (commonly used)
0 or function key [home] This is a number "0": Move to the top character of this line (commonly used)
$ Or move the function key [end] to the last character of the line (commonly used)
G moves to the last line of the file (frequently used)
Gg moves to the first line of this file, which is equivalent to 1 GB! (Common)
N <enter> N is a number. Move the cursor down n rows (commonly used)
/Word searches for a string named word under the cursor. For example, to search for the vbird string in the file, enter/vbird! (Common)
: N1, N2s/word1/word2/g N1 is not N2 is a number. Search for the word1 string between the values of line N1 and line N2, and replace the string with word2!
For example, if you search for vbird between 100 and 200 and replace it with vbird: ": 100,200 S/vbird/g 』. (Common)
: 1, $ S/word1/word2/g searches for the word1 string from the first row to the last row, and replaces this string with word2! (Common)
: 1, $ S/word1/word2/GC searches for the word1 string from the first row to the last row, and replaces the string with word2!
The prompt characters are displayed before replacement to confirm (confirm) whether to replace! (Common)
X, X in a row, X is to delete a character backward (equivalent to a pair of [del] keys), X is to delete a character forward (equivalent to a pair of [backspace], that is, the Return key) (common)
Dd deletes the entire column of the cursor (commonly used)
Ndd n is a number. Delete the n-down column where the cursor is located. For example, 20 dd deletes 20 columns (commonly used)
YY copy the row of the cursor (commonly used)
Nyy N is a number. Copy the n-down column where the cursor is located. For example, if 20yy is used, 20 columns are copied (commonly used)
P, P: paste the copied data to the next row of the cursor, and P to the last row of the cursor!
For example, I have already copied 10 rows of data with the cursor in 20th rows.
After you press P, the 10 rows of data will be pasted after the original 20 rows, that is, from 21 rows. But what if I press P?
Then the original 20th rows will be pushed to 30 rows. (Common)
U restores the previous action. (Common)
[CTRL] + R redo the previous action. (Common)
. Do not doubt! This is the decimal point! It means to repeat the previous action. If you want to repeat the deletion, repeat, and so on, just press the decimal point! (Common)
I, I enter the insert mode: I is "insert from the current cursor", I is "insert from the first non-space character in the current row 』. (Common)
R, R enters replace mode: R will replace the character where the cursor is located only once; R will replace the text of the cursor where the cursor is located until ESC is pressed; (commonly used)
[ESC] exit the editing mode and return to normal mode (commonly used)
: W writes the edited data to the hard disk file (commonly used)
: Q leaves VI (commonly used)
: WQ is stored and left. If it is: WQ! It is forced to save and leave (commonly used)

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.