Common VI operations

Source: Internet
Author: User

I have been using VI for a short time. I didn't intentionally learn VI command usage, but I got familiar with it when I was using it. Although it was slow, I remember it quite well, write down the commands I have mastered.

 

1. delete operation

X delete a single character at the cursor

Dd deletes the row where the cursor is located.
DW deletes all characters from the current character to the end of a word including Spaces
# X for example, 3x Delete the three characters to the right of the cursor
# Dd For example, 3DD deletes three lines of text from the current row

 

2. Cancel the operation
U command to cancel the last operation, you can use multiple times to restore the original operation
U cancel all operations
CTRL + R can be used to restore operations using the U command

 

3. copy operation
Run the YY command to copy the entire line to the VI buffer.
YW copies the content from the current cursor position to the end of the word to the VI cache, which is equivalent to copying a word.
Y $ copy the cursor to the cache area at the end of the row
Y ^ copy the cursor to the cache area from the beginning of the line
# Yy. For example, 5yy means copying 5 rows.
# YW: for example, 2yw means copying two words.
If you want to copy the content between Row M and row N, you can enter m in the last row mode. For example, NY: 3, 5y copies the content from row 3 to row 5 to the cache area.

 

4. Paste

P

 

 

The new commands will be supplemented later.

 

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.